FLAMEGPU / FLAMEGPU2

FLAME GPU 2 is a GPU accelerated agent based modelling framework for CUDA C++ and Python
https://flamegpu.com
MIT License
106 stars 21 forks source link

Conda Python Package Distribution #649

Open ptheywood opened 3 years ago

ptheywood commented 3 years ago

Conda is an alternative python package distribution mechanism to pip/pypi.

It is not as widely use due to pip and pypi being the defacto defaults, but is widely used in the scientific community.

The main advantage of conda over pip is that it can manage non python dependencies, such as the cuda toolkit.

Several large/populat CUDA + python packages prefer conda as their package distribution mechanism to some of the features it offers comapred to pypi, including rapids and torch.

Conda allows packages to depend on nvidia provided cudatoolkit packages, with versions specified, unlike pypi, allowing users to requrest the latest version of a package, built with CUDA X.Y which is not possible using pypi + local verison +cudaXY labels.

The conda EULA however should also be considered, as this was changed in 2020? to be less favourable than before, but in practice this shouldn't be a issue.

I'm not yet famililar enough with the conda packaging process to weigh up on how much effort this would be, without cmake/swig based setup, as most examples are from a mostly pure python packaging, but things to consider would be:

See #605 for some past notes/discussion

ptheywood commented 3 years ago

Conda packages do not have an equivanelt to the extras/extras_require part of pypi/wheel packages which are being considered for optional dependencies. There are open issues on the conda repo to add this feature, but the general consensus so far is to use conda meta packages.

A conda metapackage is a package which has no files, only metadata (i.e. depends on packages x and y). I.e. we could have the core pyflamegpu pacakge, and a pyflamegpu-visualisation metapackage which depends on the core pyflamegpu and the visualisation compontent? I don't fully understand this yet, but it's worth making a note of.

ptheywood commented 3 years ago

Package Names and filenames

source

Conda Channels.

source

Labels

source

Package Metadata

source

These are just some key points while scanning the referecned source. Not comprehensive.

Other conda packages

Possible files to create

conda/
└── recipes
    ├── libflamegpu
    │   ├── bld.bat
    │   ├── build.sh
    │   └── meta.yaml
    └── pyflamegpu
        ├── bld.bat
        ├── build.sh
        └── meta.yaml

And maybe visualisation variants of the above, and/or console versions too, depending on how splitting that goes.

The pyflamegpu package metadata would depend on libflamepgu metadata (if we package both on conda). Alternatively we could just provide pyflamegpu if we do not dist libflamegpu separately.

ptheywood commented 3 years ago

Conda is looking more viable / likely to be our chosen method of distribution, as there are GL related conda packages we might be able to leverage to avoid redistibuting ourselves, if that's even required for conda binary distribution.

Pip/pypi is looking less and less viable (for visuaslisation distribution)

ptheywood commented 2 years ago

If we are to make a conda package, we will need to tweak the dll loading logic for windows + python 3.8+ when it is patched to use add_dll_directory when finding nvrtc etc, as conda doesn't do the same as cpython.

ptheywood commented 1 year ago

The Conda forge maintainers documentation has some very useful info about making packages. I doubt we'll push to conda-forge immediately, instead using our own channel, but most of this still applies and doesn't look too bad.

https://conda-forge.org/docs/maintainer/knowledge_base.html

ptheywood commented 1 year ago

CUDA 12.x needs handling differently to 11.x it seems, in a good way (can specify the parts of cuda needed, so installs are much lighter).

https://github.com/conda-forge/cuda-version-feedstock/blob/main/recipe/README.md

Rapids/pytorch are probably a good source of how to deal with that.

Robadob commented 1 year ago

If we are to make a conda package, we will need to tweak the dll loading logic for windows + python 3.8+ when it is patched to use add_dll_directory when finding nvrtc etc, as conda doesn't do the same as cpython.

https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#the-system-cannot-find-the-path-specified-on-windows

Best evidence I can find, is that we wouldn't require that data.