[cig-commits] [commit] devel: improve portability for Python includes (ea5725a)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Fri Jul 18 02:09:41 PDT 2014
Repository : https://github.com/geodynamics/specfem3d_globe
On branch : devel
Link : https://github.com/geodynamics/specfem3d_globe/compare/19ecfecc2be566a6dee5a6b8e753f19bbb738665...50aed8d6c6d70119443d8b3e780d113033f60af2
>---------------------------------------------------------------
commit ea5725a2ccce61d0181c3f66b28897183c3bfaf3
Author: Kevin Pouget <kevin.pouget at imag.fr>
Date: Fri Jul 18 09:36:32 2014 +0200
improve portability for Python includes
>---------------------------------------------------------------
ea5725a2ccce61d0181c3f66b28897183c3bfaf3
.../gpuTrace/Makefile | 80 ++++++++++++++++++++++
.../gpuTrace/gpu_helper_py.c | 3 +-
2 files changed, 81 insertions(+), 2 deletions(-)
diff --git a/utils/BOAST_framework_to_develop_the_CUDA_and_OpenCL_routines_of_SPECFEM/gpuTrace/Makefile b/utils/BOAST_framework_to_develop_the_CUDA_and_OpenCL_routines_of_SPECFEM/gpuTrace/Makefile
new file mode 100644
index 0000000..bf7167d
--- /dev/null
+++ b/utils/BOAST_framework_to_develop_the_CUDA_and_OpenCL_routines_of_SPECFEM/gpuTrace/Makefile
@@ -0,0 +1,80 @@
+################
+### Config ####
+################
+
+WITH_OCL = yes
+WITH_CUDA = yes
+
+################
+### Defaults ##
+################
+
+SO_NAME := ldChecker.so
+
+MPI_INC := -I/usr/include/openmpi-x86_64/ -I/usr/lib/openmpi/include
+
+PY_CFLAGS := $(shell python3-config --includes) -DPYTHON_MOD_PATH=$(shell pwd)
+PY_LDFLAGS := $(shell python3-config --libs)
+
+SO_CFLAGS := -fPIC
+SO_LDFLAGS := -fPIC -rdynamic -shared $(PY_LDFLAGS)
+
+CFLAGS := $(SO_CFLAGS) -g -O0 -std=gnu99 -Werror -Wall -pedantic -Wno-format-security $(MPI_INC)
+
+CUDA_CFLAGS := -I/usr/local/cuda-5.5/targets/x86_64-linux/include/ -I/usr/local/cuda-5.5/include
+
+#CUDA_HELPER = cuda_helper_preprocessed.c
+CUDA_HELPER = gpu_helper_py.o
+
+################
+### Common ####
+################
+
+ifeq ($(WITH_OCL), yes)
+GPU_INSTR := $(GPU_INSTR) instr-ocl.o
+HELPER_HEADER := $(HELPER_HEADER) ocl_helper.h
+endif
+
+ifeq ($(WITH_CUDA), yes)
+GPU_INSTR := $(GPU_INSTR) instr-cuda.o
+HELPER_HEADER := $(HELPER_HEADER) cuda_helper.h
+endif
+
+all : $(SO_NAME)
+
+$(SO_NAME) : $(GPU_INSTR) gpu_helper_py.o ldChecker.o
+ gcc -o $@ $^ $(SO_LDFLAGS) -lpython3.3m
+
+gpu_helper_py.o : gpu_helper_py.c $(HELPER_HEADER)
+ gcc -o $@ -c $< $(CFLAGS) $(PY_CFLAGS)
+
+ldChecker.o : ldChecker.c ldChecker.h $(HELPER_HEADER)
+ gcc -o $@ -c $< $(CFLAGS) $(SO_CFLAGS) $(MPI_INC)
+
+clean : clean-python
+ rm -fv *.o *.so
+
+clean-python :
+ rm -rf __pycache__
+
+get_env_preload :
+ @echo LD_PRELOAD=$(shell pwd)/$(SO_NAME):libpython3.3m.so
+
+################
+### OpenCL ####
+################
+
+instr-ocl.o : instr-ocl.c ocl_helper.h ldChecker.h
+ gcc -o $@ -c $< $(CFLAGS)
+
+##############
+### CUDA ####
+##############
+
+cuda_helper_preprocessed.c : cuda_helper_preprocessor.py $(CUDA_BIN)
+ python3 $< $(CUDA_BIN) > $@
+
+instr-cuda.o : instr-cuda.c $(CUDA_HELPER) ldChecker.o
+ gcc -o $@ -c $< $(CFLAGS) $(CUDA_CFLAGS)
+
+
diff --git a/utils/BOAST_framework_to_develop_the_CUDA_and_OpenCL_routines_of_SPECFEM/gpuTrace/gpu_helper_py.c b/utils/BOAST_framework_to_develop_the_CUDA_and_OpenCL_routines_of_SPECFEM/gpuTrace/gpu_helper_py.c
index c488d44..b7997c8 100644
--- a/utils/BOAST_framework_to_develop_the_CUDA_and_OpenCL_routines_of_SPECFEM/gpuTrace/gpu_helper_py.c
+++ b/utils/BOAST_framework_to_develop_the_CUDA_and_OpenCL_routines_of_SPECFEM/gpuTrace/gpu_helper_py.c
@@ -1,4 +1,4 @@
-#include <python3.3m/Python.h>
+#include <Python.h>
#include "ocl_helper.h"
#include "cuda_helper.h"
@@ -33,7 +33,6 @@ static void init_helper(void) {
PyObject *pDict, *pModule;
Py_Initialize();
- //PySys_SetPath(LSTR(PYTHON_MOD_PATH));
PyObject *sys_path;
PyObject *path;
More information about the CIG-COMMITS
mailing list