diff --git a/code/python/Makefile b/code/python/Makefile index 82b2b0e6e9ad1e191e172634c2ff500d2f7fe6c2..ec73c52ca264acfb1e2439451735359d2b2f8ed5 100644 --- a/code/python/Makefile +++ b/code/python/Makefile @@ -1,3 +1,9 @@ + +PYTHON_VERSION ::= $(word 2,$(shell python3 --version)) +PYTHON_MAJOR ::= $(word 1,$(subst ., ,$(PYTHON_VERSION))) +PYTHON_MINOR ::= $(word 2,$(subst ., ,$(PYTHON_VERSION))) +PYTHON_INCLUDE ::= /usr/include/python$(PYTHON_MAJOR).$(PYTHON_MINOR) + all: mandel.so libmandelc.so solution: mandel.so libmandelc.so @@ -5,7 +11,7 @@ mandel.so:mandel_module.o libmandel.so g++ -shared $^ -o $@ mandel_module.o:mandel_module.cpp - g++ -pthread -O3 -Wall -std=c++14 -fPIC -I. -I/usr/include/python3.8 -c $< -o $@ + g++ -pthread -O3 -Wall -std=c++14 -fPIC -I. -I$(PYTHON_INCLUDE) -c $< -o $@ libmandelc.so:mandel_cwrapper.o libmandel.so g++ -shared $^ -o $@ @@ -18,3 +24,7 @@ libmandel.so:mandel.cpp Complex.hpp clean: rm -rf *.o *.so *~ *pyc *pyo *svg + +debug: + @echo Python minor version: $(PYTHON_INCLUDE) + diff --git a/code/python/README.md b/code/python/README.md index e3709aa5757c3bef0df0ebfdd8e3ad6ecce1f903..dc2b02a829dad4c106c79eeeb9488219df4faa6a 100644 --- a/code/python/README.md +++ b/code/python/README.md @@ -2,9 +2,9 @@ ## Instructions * look at the original python code `mandel.py` -* time it +* time it (`time python3 mandel.py`) * look at the code in `mandel.hpp/cpp` -* look at the python module mandel `module.cpp` +* look at the python module mandel `mandel_module.cpp` * compile and modify `mandel.py` to use it * see the gain in time * look at the C wrapper in `mandel_cwrapper.cpp` diff --git a/docker/Dockerfile b/docker/Dockerfile index 42bdf9b2f090fa233fb68850b7bd70d1cedcbbef..f09c9fefa56dd1e6c76291453722afb095fc4a96 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,5 @@ -# Version 1 +# Version 2, en Python3 FROM gcc:9.3.0 @@ -7,18 +7,18 @@ FROM gcc:9.3.0 SHELL ["/bin/bash","-c"] -# timezone +# Timezone ENV TZ=Europe/Paris -# apt-get general preparation +# Apt-get General Preparation RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get install -y apt-utils -# c++ tools +# C++ Tools RUN apt-get install -y build-essential \ && apt-get install -y cppcheck \ @@ -28,22 +28,24 @@ RUN apt-get install -y build-essential \ RUN echo "set auto-load safe-path /" > /root/.gdbinit -# python +# Python +# It seems I MUST say 3.7 for dev :s -RUN apt-get install -y python-backports.functools-lru-cache \ -&& apt-get install -y python-tk \ -&& apt-get install -y python-pip +RUN apt-get install -y python3.7 \ +&& apt-get install -y python3.7-dev \ +&& apt-get install -y python3-pip \ +&& apt-get install -y python3-tk -RUN pip install numpy -RUN pip install matplotlib +RUN pip3 install numpy +RUN pip3 install matplotlib -# other +# Other RUN rm -rf /var/lib/apt/lists/* ENV PATH=${PATH}:. ENV LD_LIBRARY_PATH=. -# start a shell by default +# Start a shell by default CMD bash diff --git a/docker/name.txt b/docker/name.txt index a3dffb481b05a5bdbd02a1f32452583a9573e3c8..712bb5862bdbce1272acd55128acd1a07399bd80 100644 --- a/docker/name.txt +++ b/docker/name.txt @@ -1 +1 @@ -gitlab-registry.cern.ch/sponce/cpluspluscourse:v1 \ No newline at end of file +gitlab-registry.cern.ch/sponce/cpluspluscourse:v2 \ No newline at end of file