I am trying to apply openmp and mpi techniques to an open source C program which requires "cmake . && make" to be built. I already found at How to set linker flags for OpenMP in CMake's try_compile function how to include the -fopenmp flags but still confused about mpi. What can I do about that?
相关问题
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- Index of single bit in long integer (in C) [duplic
- Equivalent of std::pair in C
OpenMP
Is this a question about OpenMP? Then all you have to do is compile with
-fopenmp
which you can do by appending it toCMAKE_C_FLAGS
, for example:MPI
For MPI, you have to find mpi first
then add it's header files to your search path
and finally link your program(s) (which is
my_mpi_target
in my case)In modern CMake 3.X which is target based, the CMakeLists.txt should look like this: