From 627c35eb0bcca4492ad1973e5cfac6584e2d5c1b Mon Sep 17 00:00:00 2001 From: David Chamont <chamont@in2p3.fr> Date: Fri, 9 Oct 2020 16:18:39 +0200 Subject: [PATCH 1/4] typo --- code/python/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/python/README.md b/code/python/README.md index e3709aa..dc2b02a 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` -- GitLab From 7693cf5fa25be7bf886e9cba20b4cec6507a83f3 Mon Sep 17 00:00:00 2001 From: David Chamont <chamont@in2p3.fr> Date: Fri, 9 Oct 2020 16:19:45 +0200 Subject: [PATCH 2/4] Makefile self adapt to the python3 minor version available. --- code/python/Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/python/Makefile b/code/python/Makefile index 82b2b0e..ec73c52 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) + -- GitLab From 156d13be016369f6a2bafcb4e6e6e14ce286dd33 Mon Sep 17 00:00:00 2001 From: David Chamont <chamont@in2p3.fr> Date: Fri, 9 Oct 2020 16:20:41 +0200 Subject: [PATCH 3/4] Upgrade to Python3 --- docker/Dockerfile | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 42bdf9b..f09c9fe 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 -- GitLab From 0206579a015e34570ede60198dee8369d3508a5b Mon Sep 17 00:00:00 2001 From: David Chamont <chamont@in2p3.fr> Date: Fri, 9 Oct 2020 16:21:00 +0200 Subject: [PATCH 4/4] Upgrade to Python3 --- docker/name.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/name.txt b/docker/name.txt index a3dffb4..712bb58 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 -- GitLab