8.6.5 : The CMakeLists.txt file
Now, let's write the CMakeLists.txt file :
First we manage the project name and the minimal
cmake version for the file :
1
2
|
project(ReductionWrapper)
cmake_minimum_required(VERSION 3.0)
|
Then, we get the files used to build the module :
1
|
file(GLOB moduleSrc "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
|
We call the
cmake function to create a module :
1
|
createPythonModule(install_reduction_module setup.py ${moduleSrc})
|
Now, we call the
cmake function to run the python performances tests
1
2
|
runPythonExample(reductionIntrinsicsPython.py install_reduction_module)
runPythonExample(reductionNumpyPython.py install_asterics_hpc_module)
|
Finally, we make some plots to compare the Python performances with the C++ ones :
1
2
3
|
plotPerf("reductionBasePy" reductionNumpyPython reduction_real_Ofast reduction_real_vectorize_Ofast)
plotPerf("reductionSummaryPython" reductionNumpyPython reduction_real_Ofast reduction_real_vectorize_Ofast reductionIntrinsicsPython reduction_real_intrinsics_interleave8_O3)
|
The full
CMakeLists.txt file :
1
2
3
4
5
6
7
8
9
10
11
12
13
|
project(ReductionWrapper)
cmake_minimum_required(VERSION 3.0)
file(GLOB moduleSrc "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
createPythonModule(install_reduction_module setup.py ${moduleSrc})
runPythonExample(reductionIntrinsicsPython.py install_reduction_module)
runPythonExample(reductionNumpyPython.py install_asterics_hpc_module)
plotPerf("reductionBasePy" reductionNumpyPython reduction_real_Ofast reduction_real_vectorize_Ofast)
plotPerf("reductionSummaryPython" reductionNumpyPython reduction_real_Ofast reduction_real_vectorize_Ofast reductionIntrinsicsPython reduction_real_intrinsics_interleave8_O3)
|
You can download it
here.