3 include(CheckIncludeFiles)
5 #option(THREAD_PTHREADS "Use posix threads" ON)
8 if (CMAKE_USE_PTHREADS_INIT)
9 check_include_files(pthread.h HAVE_PTHREAD_H)
10 #set(THREAD_PTHREADS 1)
11 add_definitions(-DTHREAD_PTHREADS)
12 set(THREAD_MPI_SRC thread_mpi/threads.c thread_mpi/tmpi_init.c
13 thread_mpi/errhandler.c thread_mpi/type.c
14 thread_mpi/group.c thread_mpi/comm.c
15 thread_mpi/topology.c thread_mpi/send_recv.c
16 thread_mpi/collective.c)
17 set(THREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
18 else (CMAKE_USE_PTHREADS_INIT)
19 if (CMAKE_USE_WIN32_THREADS_INIT)
21 add_definitions(-DTHREAD_WINDOWS)
22 set(THREAD_MPI_SRC thread_mpi/threads.c thread_mpi/tmpi_init.c
23 thread_mpi/errhandler.c thread_mpi/type.c
24 thread_mpi/group.c thread_mpi/comm.c
25 thread_mpi/topology.c thread_mpi/send_recv.c
26 thread_mpi/collective.c)
28 endif (CMAKE_USE_WIN32_THREADS_INIT)
29 endif (CMAKE_USE_PTHREADS_INIT)
31 # the busy waiting option
32 option(THREAD_MPI_BUSY_WAIT "Use busy waits for thread_mpi synchronization. Provides lower latency, but higher unneccesary CPU usage." ON)
33 mark_as_advanced(THREAD_MPI_BUSY_WAIT)
34 if (THREAD_MPI_BUSY_WAIT)
36 else (THREAD_MPI_BUSY_WAIT)
37 add_definitions(-DTMPI_NO_BUSY_WAIT)
38 endif (THREAD_MPI_BUSY_WAIT)
40 # the copy buffer option
41 option(THREAD_MPI_COPY_BUFFER "Use an intermediate copy buffer for small message sizes, to allow blocking sends to return quickly." ON)
42 mark_as_advanced(THREAD_MPI_COPY_BUFFER)
43 if (THREAD_MPI_COPY_BUFFER)
45 else (THREAD_MPI_COPY_BUFFER)
46 add_definitions(-DTMPI_NO_COPY_BUFFER)
47 endif (THREAD_MPI_COPY_BUFFER)