Salome HOME
Copyright update 2021
[tools/medcoupling.git] / src / ParaMEDMEMTest / MPIAccess / CMakeLists.txt
1 # Copyright (C) 2012-2021  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 ADD_DEFINITIONS(${MPI_DEFINITIONS} ${CPPUNIT_DEFINITIONS})
21
22 INCLUDE_DIRECTORIES(
23   ${MPI_INCLUDE_DIRS}
24   ${CPPUNIT_INCLUDE_DIRS}
25   ${CMAKE_CURRENT_SOURCE_DIR}/..
26   ${CMAKE_CURRENT_SOURCE_DIR}/../../ParaMEDMEM
27   ${CMAKE_CURRENT_SOURCE_DIR}/../../ParaMEDMEM/MPIAccess
28   ${CMAKE_CURRENT_SOURCE_DIR}/../../MEDCoupling
29   ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNEL
30   ${CMAKE_CURRENT_SOURCE_DIR}/../../INTERP_KERNEL/Bases
31 )
32
33 SET(MPIAccessTest_SOURCES
34   MPIAccessDECTest.cxx
35   test_AllToAllDEC.cxx
36   test_AllToAllvDEC.cxx
37   test_AllToAllTimeDEC.cxx
38   test_AllToAllvTimeDEC.cxx
39   test_AllToAllvTimeDoubleDEC.cxx
40   MPIAccessTest.cxx
41   test_MPI_Access_Send_Recv.cxx
42   test_MPI_Access_Cyclic_Send_Recv.cxx
43   test_MPI_Access_SendRecv.cxx
44   test_MPI_Access_ISend_IRecv.cxx
45   test_MPI_Access_Cyclic_ISend_IRecv.cxx
46   test_MPI_Access_ISendRecv.cxx
47   test_MPI_Access_Probe.cxx
48   test_MPI_Access_IProbe.cxx
49   test_MPI_Access_Cancel.cxx
50   test_MPI_Access_Send_Recv_Length.cxx
51   test_MPI_Access_ISend_IRecv_Length.cxx
52   test_MPI_Access_ISend_IRecv_Length_1.cxx
53   test_MPI_Access_Time.cxx
54   test_MPI_Access_Time_0.cxx
55   test_MPI_Access_ISend_IRecv_BottleNeck.cxx
56   )
57
58 ADD_LIBRARY(MPIAccessTest ${MPIAccessTest_SOURCES})
59 SET_TARGET_PROPERTIES(MPIAccessTest PROPERTIES COMPILE_FLAGS "")
60 TARGET_LINK_LIBRARIES(MPIAccessTest paramedmem  ${CPPUNIT_LIBRARIES})
61 INSTALL(TARGETS MPIAccessTest DESTINATION ${MEDCOUPLING_INSTALL_LIBS})
62
63 SET(TESTSMPIAccess)
64 SET(TestMPIAccessDEC_SOURCES
65   TestMPIAccessDEC.cxx
66   )
67 LIST(APPEND TESTSMPIAccess TestMPIAccessDEC)
68
69 SET(TestMPIAccess_SOURCES
70   TestMPIAccess.cxx
71   )
72 LIST(APPEND TESTSMPIAccess TestMPIAccess)
73
74 FOREACH(bintest ${TESTSMPIAccess})
75   ADD_EXECUTABLE(${bintest} ${${bintest}_SOURCES})
76   TARGET_LINK_LIBRARIES(${bintest} MPIAccessTest)
77 ENDFOREACH()
78
79 # Now add CMake tests 
80 SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
81
82 #  -- some tests require 2, 3, 4 or 5 procs --
83 # MPICH does not support --oversubscribe:
84 IF(NOT ${MPIEXEC_EXECUTABLE} MATCHES "mpich")
85     SET(_oversub_opt "--oversubscribe")
86 ENDIF()
87
88 ADD_TEST(NAME TestMPIAccess_Proc2 COMMAND ${MPIEXEC} -np 2 ${_oversub_opt} $<TARGET_FILE:TestMPIAccess>)
89 SET_TESTS_PROPERTIES(TestMPIAccess_Proc2 PROPERTIES ENVIRONMENT "${tests_env}")
90 ADD_TEST(NAME TestMPIAccess_Proc3 COMMAND ${MPIEXEC} -np 3 ${_oversub_opt} $<TARGET_FILE:TestMPIAccess>)
91 SET_TESTS_PROPERTIES(TestMPIAccess_Proc3 PROPERTIES ENVIRONMENT "${tests_env}")
92
93 ADD_TEST(NAME TestMPIAccessDEC_Proc4 COMMAND ${MPIEXEC} -np 4 ${_oversub_opt} $<TARGET_FILE:TestMPIAccessDEC>)
94 SET_TESTS_PROPERTIES(TestMPIAccessDEC_Proc4 PROPERTIES ENVIRONMENT "${tests_env}")
95
96 # Installation rules
97 INSTALL(TARGETS ${TESTSMPIAccess} DESTINATION ${MEDCOUPLING_INSTALL_BINS})
98 SET(COMMON_HEADERS_HXX
99   MPIAccessDECTest.hxx
100   MPIAccessTest.hxx
101 )
102 INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})