7.5.6 : 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(SaxpyWrapper) 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_saxpy_module setup.py ${moduleSrc})
|
We should wait for the asterichpc module install
1 |
add_dependencies(install_saxpy_module install_asterics_hpc_module)
|
Now, we call the cmake function to run the python performances tests
1 2 3 |
runPythonExample(saxpyIntrinsicsPython.py install_saxpy_module) runPythonExample(saxpyBasePython.py install_asterics_hpc_module) runPythonExample(saxpyNumpyPython.py install_asterics_hpc_module) |
Finally, we make some plots to compare the Python performances with the C++ ones :
1 2 3 |
plotPerf("saxpyBasePy" saxpyBasePython saxpyNumpyPython saxpy_O3 saxpy_vectorize) plotPerf("saxpySummaryPython" saxpy_O3 saxpyIntrinsicsPython saxpy_vectorize saxpy_intrinsics) |
The full CMakeLists.txt file :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
project(SaxpyWrapper) cmake_minimum_required(VERSION 3.0) file(GLOB moduleSrc "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.py") createPythonModule(install_saxpy_module setup.py ${moduleSrc}) add_dependencies(install_saxpy_module install_asterics_hpc_module) runPythonExample(saxpyIntrinsicsPython.py install_saxpy_module) runPythonExample(saxpyBasePython.py install_asterics_hpc_module) runPythonExample(saxpyNumpyPython.py install_asterics_hpc_module) plotPerf("saxpyBasePy" saxpyBasePython saxpyNumpyPython saxpy_O3 saxpy_vectorize) plotPerf("saxpySummaryPython" saxpy_O3 saxpyIntrinsicsPython saxpy_vectorize saxpy_intrinsics) |
You can download it here.