Create Docker wheel builder#592
Conversation
|
You may also want to consolidate |
|
This is very cool - would it be possible to build them on manylinux2014 (https://github.com/pypa/manylinux) for compatibility across linuxes? https://github.com/ameli/manylinux-cuda has some docker files for installing CUDA on top of many linux |
|
I can have a go at basing it on |
|
That'd be awesome - GeNN doesn't need cuDNN at all, just cuRAND |
|
Here you go! I've renamed the previous target (use it with: Note that building against python 3.12 currently fails (probably to do with it still being in beta) so I included a clause to skip it which will eventually need to be removed. Also the build process still uses the double |
neworderofjamie
left a comment
There was a problem hiding this comment.
Very cool! manylinux wheels will be an excellent feature for GeNN 5.0.0
| LABEL org.opencontainers.image.documentation="https://genn-team.github.io/" | ||
| LABEL org.opencontainers.image.source="https://github.com/genn-team/genn" | ||
| LABEL org.opencontainers.image.title="GeNN Docker image" | ||
| LABEL maintainer="J.C.Knight@sussex.ac.uk" \ |
There was a problem hiding this comment.
thank you for the tidying here - I didn't realise just how directly dockerfile lines mapped to layers and thus massive disk wastage when I wrote this
| @@ -0,0 +1,46 @@ | |||
| # syntax=docker/dockerfile:1 | |||
There was a problem hiding this comment.
What's the point of keeping (and maintaining) this one? if you have manylinux wheels you can use them on all the ubunti
There was a problem hiding this comment.
Well you can ignore it for now but it might be a more robust alternative for Ubuntu users and it's a little simpler so might also be a useful reference for when the build system changes.
Dockerfile.ubuntu_builder
Outdated
| WORKDIR ${GENN_PATH} | ||
|
|
||
| # Install GeNN and PyGeNN | ||
| RUN make install -j `lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l` |
There was a problem hiding this comment.
there is no need to make install when all you're doing is build PyGeNN - that's only if you want a system-wide installation to use GeNN from C++
build-wheels.sh
Outdated
| # "${PYBIN}/pip" install -r /io/dev-requirements.txt | ||
| "${PYBIN}/pip" install numpy swig | ||
| # "${PYBIN}/pip" wheel /opt/genn/ --no-deps -w dist/ | ||
| make install -j `lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l` |
There was a problem hiding this comment.
Again, no need to make install
build-wheels.sh
Outdated
| "${PYBIN}/pip" install numpy swig | ||
| # "${PYBIN}/pip" wheel /opt/genn/ --no-deps -w dist/ | ||
| make install -j `lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l` | ||
| make DYNAMIC=1 LIBRARY_DIRECTORY=${GENN_PATH}/pygenn/genn_wrapper/ -j `lscpu -p | egrep -v '^#' | sort -u -t, -k 2,4 | wc -l` |
There was a problem hiding this comment.
this doesn't link against python so could be done once outside of the loop
There was a problem hiding this comment.
I must have misunderstood something then. The packages need to be installed within the loop still though don't they? Since GeNN uses them for bindings, doesn't that also mean it should be built within the loop?
There was a problem hiding this comment.
the stuff you're installing with pip definitely need to be done within the loop but make DYNAMICS=1 etc etc isn't Python-specific, it just builds GeNN as shared libraries and sticks them where the python build system expects them to be so can move it outside the loop (it probably won't do anything after the first iteration anyway cos nothing will have changed)
| --build-arg CUDA=$(CUDA) \ | ||
| --target=output --output type=local,dest=dist/ . | ||
|
|
||
| # TODO: Consider build with docker run instead of docker build |
There was a problem hiding this comment.
What would the advantages of that be?
There was a problem hiding this comment.
I'm not sure yet, beyond saving a bit of time in image building. It was the method used in the example but I'd need to investigate a bit more.
| FROM nvidia/cuda:${BASE} | ||
|
|
||
| LABEL maintainer="J.C.Knight@sussex.ac.uk" | ||
| LABEL version="4.8.0" |
There was a problem hiding this comment.
Do you know if there's any way to read this from the version.txt? I've managed to convince setuptools and doxygen to do this but couldn't figure it out for docker
There was a problem hiding this comment.
Well passing it as a build-arg is simple and explicit but I expect you could also do it with the right cat / sed incantation.
This adds
Dockerfile.builderand a Makefile target (make wheel) to cleanly build python wheels within a Docker container. The versions of CUDA and Python can be specified by passing build arguments.