6.7.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(HadamardWrapper)
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_hadamard_module setup.py ${moduleSrc})
Now, we call the cmake function to run the python performances tests
1
2
3
4
runPythonExample(hadamardIntrinsicsPitchPython.py install_hadamard_module)
runPythonExample(hadamardBasePython.py install_asterics_hpc_module)
runPythonExample(hadamardNumpyPython.py install_asterics_hpc_module)
runPythonExample(hadamardListPython.py install_asterics_hpc_module)
Finally, we make some plots to compare the Python performances with the C++ ones :
1
2
3
4
5
plotPerf("hadamardBasePy" hadamard_product_O3 hadamard_product_vectorize hadamardBasePython hadamardNumpyPython)

plotPerf("hadamardSummaryPython" hadamard_product_O3 hadamard_product_vectorize hadamard_product_intrinsics hadamardIntrinsicsPitchPython)

plotPerf("hadamardListPy" hadamard_product_O3 hadamardBasePython hadamardNumpyPython hadamardListPython)
The full CMakeLists.txt file :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
project(HadamardWrapper)
cmake_minimum_required(VERSION 3.0)

file(GLOB moduleSrc "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/*.py")

createPythonModule(install_hadamard_module setup.py ${moduleSrc})

runPythonExample(hadamardIntrinsicsPitchPython.py install_hadamard_module)
runPythonExample(hadamardBasePython.py install_asterics_hpc_module)
runPythonExample(hadamardNumpyPython.py install_asterics_hpc_module)
runPythonExample(hadamardListPython.py install_asterics_hpc_module)

plotPerf("hadamardBasePy" hadamard_product_O3 hadamard_product_vectorize hadamardBasePython hadamardNumpyPython)

plotPerf("hadamardSummaryPython" hadamard_product_O3 hadamard_product_vectorize hadamard_product_intrinsics hadamardIntrinsicsPitchPython)

plotPerf("hadamardListPy" hadamard_product_O3 hadamardBasePython hadamardNumpyPython hadamardListPython)
You can download it here.