kblomdahl / dream-go

Artificial go player based on reinforcement and supervised learning
Apache License 2.0
47 stars 8 forks source link

Create distributable packages for debian / redhat / windows #23

Closed kblomdahl closed 6 years ago

kblomdahl commented 6 years ago

Create downloadable packages in the following format to make installation easier:

For the most part this is fairly straight forward, we just need to pre-build a binary and package it with the weights. The main issue is in the licensing of CUDA and cuDNN.

kblomdahl commented 6 years ago

For the Linux based distributions we can side step this issue by depending on the NVIDIA packages and require the user themselves to install the packages. But this requirement is probably not viable for Windows users.


I am not a lawyer, but the following section from the cuDNN license suggest that we can re-distribute it in binary form if we include a click through license agreement during installation:

3.1. CUDNN DISTRIBUTION
Subject to the terms of the SLA and this Supplement, NVIDIA hereby grants you a non-exclusive,
non-transferable license during the applicable license term unless earlier terminated pursuant to
the SLA, to distribute the runtime files (.so, .h) when delivered to you as part of the cuDNN Licensed
Software in source code form or binary form (but not when provided to you as part of a hardware
product), subject to such distribution being solely in binary form to your licensees (“Customers”) only
as a component of your own software products having additional material functionality beyond the
redistributable cuDNN Licensed Software (each, a “Licensee Application"). Subject to the terms and
conditions of the SLA and this Supplement, you may further authorize Customers to redistribute the
cuDNN Licensed Software as incorporated into a Licensee Application, solely in binary form, provided,
however, that you shall require in your agreements with your Customers that their distributions be on
terms at least as restrictive as those applicable for your use of the cuDNN Licensed Software within a
Licensee Application. The expiration or termination of your licenses to the cuDNN Licensed Software
under the SLA and this Supplement will not affect your previous cuDNN distributions in compliance
with the SLA and this Supplement.

The above distributions are subject to the following:
- all distributions by you or your distribution channels must be consistent with the terms of the 
  AGREEMENT;
- the distributed cuDNN License Software must include valid copyright notices indicating NVIDIA’s
  ownership of the Licensed Software and (if permitted) modifications; and
- you must enter into enforceable agreements that pass down terms consistent with the terms set forth
  in the AGREEMENT for use of the distributable cuDNN License Software, including (without limitation)
  terms relating to the license grant and license restrictions, confidentiality and protection of NVIDIA’s
  Intellectual Property Rights in and to the cuDNN Licensed Software.
You are liable for the distribution and use of cuDNN Licensed Software if you failed to comply with the
distribution requirements of this Supplement. You agree to notify NVIDIA in writing of any known or
suspected distribution or use of the cuDNN Licensed Software not in compliance with the terms of the
AGREEMENT, and to enforce the terms of your agreements with respect to cuDNN Licensed Software
you distributed.

A similar clause exists within the CUDA Toolkit license agreement:

2.2. CUDA Toolkit Distribution
Subject to the terms of the SLA and this Supplement, NVIDIA hereby grants you a non-exclusive,
non-transferable license during the applicable license term unless earlier terminated pursuant to the
SLA, to distribute the CUDA Licensed Software identified in Appendix A to this Supplement when
delivered to you as part of the CUDA Toolkit in source code form or binary form (but not when provided
to you as part of a hardware product), subject to the following: (a) such distribution is solely in binary
form to your licensees (“Customers”) only as a component of your own software products having
additional material functionality beyond the redistributable CUDA Toolkit Licensed Software (each, a
“Licensee Application"); and (b) you shall design a Licensee Application such that the distributable
software files are installed only in a private (non-shared) directory location that is used only by the
Licensee Application. Subject to the terms and conditions of the SLA and this Supplement, you may
further authorize Customers to redistribute the CUDA Toolkit Licensed Software as incorporated into a
Licensee Application, solely in binary form, provided, however, that you shall require in your agreements
with your Customers that their distributions be on terms at least as restrictive as those applicable for
your use of the CUDA Toolkit Licensed Software within a Licensee Application. The expiration or
termination of your licenses to the CUDA Toolkit Licensed Software under the SLA and this Supplement
will not affect your previous CUDA Toolkit distributions in compliance with the SLA and this
Supplement.

The above distributions are subject to the following: (a) all distributions by you or your distribution
channels must be consistent with the terms of the AGREEMENT; (b) the distributed CUDA License
Software must include valid copyright notices indicating NVIDIA’s ownership of the Licensed Software
and (if permitted) modifications; and (c) you must enter into enforceable agreements that pass down
terms consistent with the terms set forth in the AGREEMENT for use of the distributable CUDA License
Software, including (without limitation) terms relating to the license grant and license restrictions,
confidentiality and protection of NVIDIA’s Intellectual Property Rights in and to the CUDA Licensed
Software. You are liable for the distribution and use of CUDA Licensed Software if you failed to comply with the distribution requirements of this Supplement. You agree to notify NVIDIA in writing of any
known or suspected distribution or use of the CUDA Licensed Software not in compliance with the terms
of the AGREEMENT, and to enforce the terms of your agreements with respect to CUDA Licensed
Software you distributed.
kblomdahl commented 6 years ago

This might be useful for creating the windows installer. I will need to create a windows virtual machine to experiment with this however (and vfio pcie passthrough to get a GPU in there):

https://github.com/wixtoolset/wix3/

kblomdahl commented 6 years ago

Due to licensing issues, I've decided to not do an installer and instead just provide a zip file for Windows. I can still bundle the cuDNN binaries if I include all of the appropriate licenses in the archive. But it simplifies the legal questions.

There is also the advantage that since Dream Go is a GTP client only with no graphical frontend on its own the users can more easily find the program if they unpacked it themselves.

alreadydone commented 6 years ago

Related discussion regarding cuDNN: https://github.com/gcp/leela-zero/issues/1188

kblomdahl commented 6 years ago

Preamble: I am not a lawyer so do not take anything I am going to say as legal advise.

I am of the opinion that the terms are not as horrible as some people seem to think. The main cause for this is because many of the business terms used in the parts that are bad only makes sense under the assumption that you are charging for your product which neither I nor leelaz are doing.

That said, if leela-chess is asking NVIDIA for legal advise then I am more than happy to wait for a response since license agreements are serious business and the consequences of getting them wrong are non-trivial.


The most common clause that I see people complaining about is the following, which deals with book keeping. However the book keeping is talking about the transactions between you and your customers, of which there are none for open source projects.

3.3. AUDIT
During the term of the AGREEMENT and for three (3) years thereafter, you will maintain all
usual and proper books and records of account relating to the cuDNN Licensed Software and
services provided under the AGREEMENT. During such period and upon written notice to
you, NVIDIA or its authorized third party auditors subject to confidentiality obligations will have
the right to inspect and audit your Enterprise books and records for the purpose of confirming
compliance with the terms of the AGREEMENT. Any such inspection and audit will be
conducted during regular business hours and no more frequently than annually unless
non-compliance was previously found. If such an inspection and audit reveals an underpayment
of any amounts payable to NVIDIA, then you will promptly remit the full amount of such
underpayment to NVIDIA, including interest accruing (without the requirement of a notice) from
the time underpayment began at the lower of 1.5% per month or the highest rate permissible by
law. If the underpaid amount exceeds five percent (5%) of the amounts payable to NVIDIA for the
period audited and/or such an inspection and audit reveals a material non-conformance with the
terms of the AGREEMENT, then you will also pay NVIDIA’s reasonable costs of conducting the
inspection and audit. Further, you agree that the party delivering the cuDNN Licensed Software to
you may collect and disclose to NVIDIA information for NVIDIA to verify your compliance with the
terms of the AGREEMENT including (without limitation) information regarding your use of the
cuDNN Licensed Software.

There is also the section about collecting information, which does not require you to collection any information about the user. It is talking about the information that NVIDIA collects in their drivers, and since we would only bundle the cuDNN binaries, not the drivers the user still has to accept the same clause during driver installation.

2.9. CONSENT TO COLLECTION AND USE OF INFORMATION
You hereby agree and acknowledge that the Software may access, collect non-personally identifiable
information about your Enterprise computer systems in order to properly optimize such systems for use
with the Software. To the extent that you use the Software, you hereby consent to all of the
foregoing, and represent and warrant that you have the right to grant such consent. In addition, you
agree that you are solely responsible for maintaining appropriate data backups and system restore
points for your Enterprise systems, and that NVIDIA will have no responsibility for any damage or
loss to such systems (including loss of data or access) arising from or relating to
any changes to the configuration, application settings, environment variables, registry, drivers, BIOS,
or other attributes of the systems (or any part of such systems) initiated through the Software;
or installation of any Software or third party software patches initiated through the Software. In
certain systems you may change your system update preferences by unchecking "Automatically
check for updates" in the "Preferences" tab of the control panel for the Software.
In connection with the receipt of the Licensed Software or services you may receive access to links
to third party websites and services and the availability of those links does not imply any endorsement
by NVIDIA. NVIDIA encourages you to review the privacy statements on those sites and services
that you choose to visit so that you can understand how they may collect, use and share personal
information of individuals. NVIDIA is not responsible or liable for:
the availability or accuracy of such links; or
the products, services or information available on or through such links; or
the privacy statements or practices of sites and services controlled by other companies or organizations. 
To the extent that you or members of your Enterprise provide to NVIDIA during registration or
otherwise personal information, you acknowledge that such information will be collected, used
and disclosed by NVIDIA in accordance with NVIDIA's privacy policy, available at URL
http://www.nvidia.com/object/privacy_policy.html.