├── CMakeLists.txt ├── LICENSE ├── PnMPIConfig.cmake.in ├── README.md ├── cmakemodules ├── FindBFD.cmake ├── Findhelp2man.cmake ├── Findhires-timers.cmake ├── Platform │ ├── BlueGeneQ-base.cmake │ ├── BlueGeneQ-dynamic-GNU-C.cmake │ ├── BlueGeneQ-dynamic-GNU-CXX.cmake │ ├── BlueGeneQ-dynamic-GNU-Fortran.cmake │ ├── BlueGeneQ-dynamic-XL-C.cmake │ ├── BlueGeneQ-dynamic-XL-CXX.cmake │ ├── BlueGeneQ-dynamic-XL-Fortran.cmake │ ├── BlueGeneQ-dynamic.cmake │ ├── BlueGeneQ-static-GNU-C.cmake │ ├── BlueGeneQ-static-GNU-CXX.cmake │ ├── BlueGeneQ-static-GNU-Fortran.cmake │ ├── BlueGeneQ-static-XL-C.cmake │ ├── BlueGeneQ-static-XL-CXX.cmake │ ├── BlueGeneQ-static-XL-Fortran.cmake │ └── BlueGeneQ-static.cmake ├── PnMPI_doc.cmake ├── PnMPI_headers.cmake ├── PnMPI_modules.cmake └── Toolchain │ ├── BlueGeneQ-gnu.cmake │ └── BlueGeneQ-xl.cmake ├── doc ├── CMakeLists.txt ├── doxygen.conf.in └── footer.html ├── externals └── CMakeLists.txt ├── extra └── build │ ├── do_cmake_bgp │ ├── do_cmake_macosx │ └── do_cmake_tlcc ├── pnmpi-config.h.in ├── src ├── CMakeLists.txt ├── modules │ ├── CMakeLists.txt │ ├── comm │ │ ├── CMakeLists.txt │ │ ├── README │ │ ├── comm.c │ │ ├── commsub-checksum.cpp │ │ ├── commsub-critpath.cpp │ │ ├── commsub-empty.cpp │ │ ├── commsub-print.cpp │ │ └── commsub.h │ ├── datatype │ │ ├── CMakeLists.txt │ │ ├── datatype.cpp │ │ ├── datatype.h │ │ └── dtprint.c │ ├── empty │ │ ├── CMakeLists.txt │ │ └── empty.w │ ├── limit-threading │ │ ├── CMakeLists.txt │ │ └── limit-threading.c │ ├── metrics │ │ ├── CMakeLists.txt │ │ ├── config.h.in │ │ ├── counter.c.w │ │ ├── doc.c │ │ ├── pnmpi-atomic.h │ │ └── timing.c.w │ ├── piggyback │ │ ├── Makefile │ │ ├── pb_datatype.c │ │ ├── pb_mod.h │ │ ├── pbdriver.c │ │ ├── piggyback.c │ │ └── ping │ │ │ ├── .pnmpi-conf │ │ │ ├── Makefile │ │ │ ├── getus.h │ │ │ └── pingpong.c │ ├── requests │ │ ├── CMakeLists.txt │ │ ├── requests.cpp │ │ └── requests.h │ ├── sample │ │ ├── CMakeLists.txt │ │ ├── sample1.c │ │ ├── sample1f.c │ │ ├── sample2.c │ │ ├── sample3.c │ │ └── sample4.c │ ├── status │ │ ├── CMakeLists.txt │ │ ├── status.c │ │ └── status.h │ ├── switch-matrix │ │ ├── CMakeLists.txt │ │ └── switch-matrix.w │ ├── timelapse │ │ ├── CMakeLists.txt │ │ ├── timelapse.c │ │ └── timelapse.h │ ├── virtual │ │ ├── CMakeLists.txt │ │ └── virtual.w │ └── wait-for-debugger │ │ ├── CMakeLists.txt │ │ └── wait-for-debugger.c ├── patch │ ├── CMakeLists.txt │ ├── config.h.in │ ├── frontend │ │ └── CMakeLists.txt │ └── patch.c ├── pnmpi │ ├── CMakeLists.txt │ ├── compiler │ │ ├── CMakeLists.txt │ │ ├── attr_private.h │ │ ├── attr_public.h │ │ ├── features.h.in │ │ └── tls.h │ ├── config.h.in │ ├── core.c │ ├── core.h │ ├── debug │ │ ├── CMakeLists.txt │ │ ├── debug_io.h │ │ ├── get_rank.c │ │ ├── pmpi_assert.h.w │ │ ├── print.h │ │ ├── print_debug.c │ │ ├── print_error.c │ │ ├── print_prefix_rank.c │ │ └── print_warning.c │ ├── finalize.c │ ├── force_link.c │ ├── force_link.h │ ├── initialization.h │ ├── initialize.c │ ├── modules │ │ ├── CMakeLists.txt │ │ ├── call_hook.c │ │ ├── const.h │ │ ├── hook_activated.c │ │ ├── hooks.h │ │ ├── modules.h │ │ └── unload.c │ ├── newstack.h.w │ ├── pmpi.h.w │ ├── pnmpi.h │ ├── pnmpimod.h │ ├── print_banner.c │ ├── service │ │ ├── CMakeLists.txt │ │ ├── callHook.c │ │ ├── changeStack.c │ │ ├── getArgument.c │ │ ├── getFunctionAddress.c │ │ ├── getGlobalByName.c │ │ ├── getModuleByName.c │ │ ├── getModuleSelf.c │ │ ├── getPcontrol.c │ │ ├── getReturnAddress.c │ │ ├── getServiceByName.c │ │ ├── getStackByName.c │ │ ├── registerGlobal.c │ │ ├── registerModule.c │ │ ├── registerService.c │ │ ├── service.h │ │ └── strerror.c │ ├── vargcall.c │ ├── wrapper.c │ ├── wrapper.h.w │ ├── wrapper │ │ ├── CMakeLists.txt │ │ ├── function_address.c │ │ ├── function_address.h │ │ ├── mpi_interface.c │ │ ├── mpi_interface.h │ │ ├── mpi_reentry.c │ │ ├── mpi_reentry.h │ │ ├── return_address.c │ │ └── return_address.h.in │ ├── wrapper_c.c.w │ └── xmpi.h.w └── pnmpize │ ├── CMakeLists.txt │ ├── config.h.in │ └── pnmpize.c └── tests ├── CMakeLists.txt ├── modules ├── CMakeLists.txt ├── limit-threading │ ├── CMakeLists.txt │ └── limit-threading.conf ├── metrics │ ├── CMakeLists.txt │ ├── counter.conf │ └── timing.c └── wait-for-debugger │ ├── CMakeLists.txt │ └── wait-for-debugger.conf ├── pnmpi ├── CMakeLists.txt ├── core │ ├── CMakeLists.txt │ ├── banner.c │ ├── hooks.c │ ├── module_name.c │ └── static_linked.c ├── debug │ ├── CMakeLists.txt │ └── message_prefix.c ├── service │ ├── CMakeLists.txt │ ├── callHook.c │ ├── getArgument.c │ ├── getArgumentSelf.c │ ├── getGlobalByName.c │ ├── getModuleByName.c │ ├── getModuleSelf.c │ ├── getPcontrol.c │ ├── getPcontrolSelf.c │ ├── getReturnAddress.c │ ├── getServiceByName.c │ ├── getStackByName.c │ ├── registerGlobal.c │ ├── registerModule.c │ └── registerService.c └── stacks │ ├── CMakeLists.txt │ └── stack.c ├── pnmpize ├── CMakeLists.txt ├── config.c ├── debug.conf ├── exec-fortran.conf └── exec.conf └── src ├── CMakeLists.txt ├── mpi_errors.h.w ├── test-mpi-sendrecv.c ├── test-mpi-sendrecv.f ├── test-mpi-threaded.c ├── test-mpi-threaded.f ├── test-mpi.c ├── test-mpi.f └── test-nompi.c /cmakemodules/FindBFD.cmake: -------------------------------------------------------------------------------- 1 | # - BFD Library module. 2 | #============================================================================= 3 | # This module finds libbfd and associated headers. 4 | # 5 | #=== Variables =============================================================== 6 | # This module will set the following variables in your project: 7 | # 8 | # BFD_INCLUDE_PATH Location of bfd.h and libiberty.h 9 | # BFD_LIBRARIES Location of libbfd.so or libbfd.a 10 | # 11 | # BFD_FOUND Whether libbfd was successfully found. 12 | # 13 | #============================================================================= 14 | include(FindPackageHandleStandardArgs) 15 | 16 | set(CMAKE_LIBRARY_PATH /lib /usr/lib /usr/local/lib) 17 | set(CMAKE_INCLUDE_PATH /usr/include /usr/local/include) 18 | 19 | find_path(BFD_INCLUDE_PATH bfd.h PATH /usr/include /usr/local/include ) 20 | find_library(BFD_LIBRARIES bfd PATH /lib /usr/lib /usr/local/lib ) 21 | 22 | find_path(IBERTY_INCLUDE_PATH libiberty.h PATH /usr/include /usr/local/include) 23 | find_library(IBERTY_LIBRARIES iberty PATH /lib /usr/lib /usr/local/lib) 24 | 25 | function(append_unique elt l) 26 | list(FIND ${l} ${elt} INDEX) 27 | if (INDEX LESS 0) 28 | list(APPEND ${l} ${elt}) 29 | endif() 30 | endfunction() 31 | 32 | append_unique(${IBERTY_INCLUDE_PATH} ${BFD_INCLUDE_PATH}) 33 | append_unique(${IBERTY_LIBRARIES} ${BFD_LIBRARIES}) 34 | 35 | find_package_handle_standard_args(BFD 36 | DEFAULT_MSG 37 | BFD_LIBRARIES BFD_INCLUDE_PATH IBERTY_LIBRARIES IBERTY_INCLUDE_PATH) 38 | 39 | if (BFD_FOUND) 40 | SET (PNMPI_HAVE_BFD ${BFD_FOUND} CACHE INTERNAL "") 41 | endif () 42 | 43 | mark_as_advanced( 44 | BFD_INCLUDE_PATH 45 | BFD_LIBRARIES 46 | IBERTY_INCLUDE_PATH 47 | IBERTY_LIBRARIES 48 | ) 49 | -------------------------------------------------------------------------------- /cmakemodules/Findhires-timers.cmake: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(FindPackageHandleStandardArgs) 31 | 32 | 33 | # Search for LLNL hires-timers library and header. 34 | find_path(HIRES_TIMERS_INCLUDE_DIR hires-timers.h) 35 | find_library(HIRES_TIMERS_LIBRARY NAMES hires-timers) 36 | mark_as_advanced(HIRES_TIMERS_INCLUDE_DIR HIRES_TIMERS_LIBRARY) 37 | 38 | 39 | # Handle the QUIET and REQUIRED arguments and set HIRES_TIMERS_FOUND to TRUE if 40 | # all listed variables are defined. 41 | find_package_handle_standard_args( 42 | HIRES_TIMERS 43 | FOUND_VAR HIRES_TIMERS_FOUND 44 | REQUIRED_VARS HIRES_TIMERS_LIBRARY HIRES_TIMERS_INCLUDE_DIR) 45 | 46 | # If all required variables have been defined, set the general variables for 47 | # using LLNL hires timers. 48 | set(HIRES_TIMERS_INCLUDE_DIRS ${HIRES_TIMERS_INCLUDE_DIR}) 49 | set(HIRES_TIMERS_LIBRARIES ${HIRES_TIMERS_LIBRARY}) 50 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-dynamic-GNU-C.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_dynamic_flags(GNU C) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-dynamic-GNU-CXX.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_dynamic_flags(GNU CXX) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-dynamic-GNU-Fortran.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_dynamic_flags(GNU Fortran) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-dynamic-XL-C.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_dynamic_flags(XL C) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_dynamic_flags(XL CXX) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-dynamic-XL-Fortran.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_dynamic_flags(XL Fortran) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-dynamic.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | include(Platform/BlueGeneQ-base) 17 | set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) 18 | set(CMAKE_FIND_LIBRARY_PREFIXES "lib") 19 | set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") 20 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-static-GNU-C.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_static_flags(GNU C) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-static-GNU-CXX.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_static_flags(GNU CXX) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-static-GNU-Fortran.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_static_flags(GNU Fortran) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-static-XL-C.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_static_flags(XL C) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-static-XL-CXX.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_static_flags(XL CXX) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-static-XL-Fortran.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | __BlueGeneQ_set_static_flags(XL Fortran) 17 | -------------------------------------------------------------------------------- /cmakemodules/Platform/BlueGeneQ-static.cmake: -------------------------------------------------------------------------------- 1 | 2 | #============================================================================= 3 | # Copyright 2010 Kitware, Inc. 4 | # Copyright 2010 Todd Gamblin 5 | # 6 | # Distributed under the OSI-approved BSD License (the "License"); 7 | # see accompanying file Copyright.txt for details. 8 | # 9 | # This software is distributed WITHOUT ANY WARRANTY; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the License for more information. 12 | #============================================================================= 13 | # (To distribute this file outside of CMake, substitute the full 14 | # License text for the above reference.) 15 | 16 | include(Platform/BlueGeneQ-base) 17 | set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE) 18 | set(CMAKE_FIND_LIBRARY_PREFIXES "lib") 19 | set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") 20 | -------------------------------------------------------------------------------- /cmakemodules/Toolchain/BlueGeneQ-gnu.cmake: -------------------------------------------------------------------------------- 1 | # Need this first to ensure that we include PnMPI's custom platform files. 2 | set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmakemodules;${CMAKE_MODULE_PATH}") 3 | 4 | # the name of the target operating system 5 | set(CMAKE_SYSTEM_NAME BlueGeneQ-dynamic) 6 | 7 | set(TOOLCHAIN_LOCATION /bgsys/drivers/ppcfloor/gnu-linux/bin) 8 | set(TOOLCHAIN_PREFIX powerpc64-bgq-linux-) 9 | 10 | set(CMAKE_C_COMPILER ${TOOLCHAIN_LOCATION}/${TOOLCHAIN_PREFIX}gcc) 11 | set(CMAKE_CXX_COMPILER ${TOOLCHAIN_LOCATION}/${TOOLCHAIN_PREFIX}g++) 12 | set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_LOCATION}/${TOOLCHAIN_PREFIX}gfortran) 13 | 14 | # Make sure MPI_COMPILER wrapper matches the gnu compilers. 15 | # Prefer local machine wrappers to driver wrappers here too. 16 | set(BGQ_MPI_COMPILER_SEARCH_PATHS 17 | /usr/local/bin 18 | /usr/bin 19 | /bgsys/drivers/ppcfloor/comm/gcc/bin) 20 | 21 | find_program(MPI_C_COMPILER NAMES mpicc PATHS ${BGQ_MPI_COMPILER_SEARCH_PATHS}) 22 | find_program(MPI_CXX_COMPILER NAMES mpicxx mpic++ PATHS ${BGQ_MPI_COMPILER_SEARCH_PATHS}) 23 | find_program(MPI_Fortran_COMPILER NAMES mpif90 mpif77 PATHS ${BGQ_MPI_COMPILER_SEARCH_PATHS}) 24 | 25 | SET(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes." FORCE) 26 | SET(MPIEXEC_EXTRA_FLAG "-ppdebug" CACHE STRING "Extraflag used to give the debug queue for srun" FORCE) 27 | -------------------------------------------------------------------------------- /cmakemodules/Toolchain/BlueGeneQ-xl.cmake: -------------------------------------------------------------------------------- 1 | # Need this first to ensure that we include PnMPI's custom platform files. 2 | set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmakemodules;${CMAKE_MODULE_PATH}") 3 | 4 | # the name of the target operating system 5 | set(CMAKE_SYSTEM_NAME BlueGeneQ-dynamic) 6 | 7 | # Set search paths to prefer local, admin-installed wrappers for the BG backend compilers 8 | set(BGQ_XL_COMPILER_SEARCH_PATHS 9 | /usr/local/bin 10 | /usr/bin 11 | /opt/ibmcmp/vac/bg/12.1/bin 12 | /opt/ibmcmp/vacpp/bg/12.1/bin 13 | /opt/ibmcmp/xlf/bg/14.1/bin) 14 | 15 | # XL C Compilers 16 | find_program(CMAKE_C_COMPILER bgxlc ${BGQ_XL_COMPILER_SEARCH_PATHS}) 17 | find_program(CMAKE_CXX_COMPILER bgxlc ${BGQ_XL_COMPILER_SEARCH_PATHS}) 18 | find_program(CMAKE_Fortran_COMPILER bgxlf90 ${BGQ_XL_COMPILER_SEARCH_PATHS}) 19 | 20 | # Make sure MPI_COMPILER wrapper matches the gnu compilers. 21 | # Prefer local machine wrappers to driver wrappers here too. 22 | set(BGQ_MPI_COMPILER_SEARCH_PATHS 23 | /usr/local/bin 24 | /usr/bin 25 | /bgsys/drivers/ppcfloor/comm/gcc/bin) 26 | 27 | find_program(MPI_C_COMPILER NAMES mpixlc mpxlc PATHS ${BGQ_MPI_COMPILER_SEARCH_PATHS}) 28 | find_program(MPI_CXX_COMPILER NAMES mpixlc mpxlc PATHS ${BGQ_MPI_COMPILER_SEARCH_PATHS}) 29 | find_program(MPI_Fortran_COMPILER NAMES mpixlf90 mpxlf90 PATHS ${BGQ_MPI_COMPILER_SEARCH_PATHS}) 30 | 31 | SET(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes." FORCE) 32 | SET(MPIEXEC_EXTRA_FLAG "-ppdebug" CACHE STRING "Extraflag used to give the debug queue for srun" FORCE) 33 | -------------------------------------------------------------------------------- /doc/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | This file is part of $projectname. 4 |

5 | LLNL-CODE-402774. Copyright ©
6 | 2008-2019 Lawrence Livermore National Laboratories, United States of America
7 | 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany
8 | 2013-2019 RWTH Aachen University, Federal Republic of Germany
9 |
10 | Distribution of the $projectname documentation is subject to terms of the $projectname LICENSE file.
11 |
12 | Generated on $date using Doxygen $doxygenversion 13 |
14 | 15 | -------------------------------------------------------------------------------- /extra/build/do_cmake_bgp: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This file is part of P^nMPI. 4 | # 5 | # Copyright (c) 6 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 7 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 8 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 9 | # 10 | # 11 | # P^nMPI is free software; you can redistribute it and/or modify it under the 12 | # terms of the GNU Lesser General Public License as published by the Free 13 | # Software Foundation version 2.1 dated February 1999. 14 | # 15 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 16 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 17 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 18 | # details. 19 | # 20 | # You should have received a copy of the GNU Lesser General Public License 21 | # along with P^nMPI; if not, write to the 22 | # 23 | # Free Software Foundation, Inc. 24 | # 51 Franklin St, Fifth Floor 25 | # Boston, MA 02110, USA 26 | # 27 | # 28 | # Written by Martin Schulz, schulzm@llnl.gov. 29 | # 30 | # LLNL-CODE-402774 31 | 32 | mpifc=mpif90 33 | 34 | cmake \ 35 | -D CMAKE_INSTALL_PREFIX=$HOME/opt/pnmpi/$SYS_TYPE \ 36 | -D CMAKE_TOOLCHAIN_FILE=../cmakemodules/BlueGeneP-gnu.cmake \ 37 | -D ENABLE_FORTRAN=OFF \ 38 | .. 39 | -------------------------------------------------------------------------------- /extra/build/do_cmake_macosx: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This file is part of P^nMPI. 4 | # 5 | # Copyright (c) 6 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 7 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 8 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 9 | # 10 | # 11 | # P^nMPI is free software; you can redistribute it and/or modify it under the 12 | # terms of the GNU Lesser General Public License as published by the Free 13 | # Software Foundation version 2.1 dated February 1999. 14 | # 15 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 16 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 17 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 18 | # details. 19 | # 20 | # You should have received a copy of the GNU Lesser General Public License 21 | # along with P^nMPI; if not, write to the 22 | # 23 | # Free Software Foundation, Inc. 24 | # 51 Franklin St, Fifth Floor 25 | # Boston, MA 02110, USA 26 | # 27 | # 28 | # Written by Martin Schulz, schulzm@llnl.gov. 29 | # 30 | # LLNL-CODE-402774 31 | 32 | cmake \ 33 | -D CMAKE_INSTALL_PREFIX=$LOCAL/pnmpi \ 34 | -D MPI_H_DIR=$LOCAL/include \ 35 | -D CMAKE_BUILD_TYPE=Debug \ 36 | -DMPI_LIBRARIES="-L$LOCAL/lib;-lmpi;-lmpi_f77" \ 37 | .. 38 | -------------------------------------------------------------------------------- /extra/build/do_cmake_tlcc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This file is part of P^nMPI. 4 | # 5 | # Copyright (c) 6 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 7 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 8 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 9 | # 10 | # 11 | # P^nMPI is free software; you can redistribute it and/or modify it under the 12 | # terms of the GNU Lesser General Public License as published by the Free 13 | # Software Foundation version 2.1 dated February 1999. 14 | # 15 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 16 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 17 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 18 | # details. 19 | # 20 | # You should have received a copy of the GNU Lesser General Public License 21 | # along with P^nMPI; if not, write to the 22 | # 23 | # Free Software Foundation, Inc. 24 | # 51 Franklin St, Fifth Floor 25 | # Boston, MA 02110, USA 26 | # 27 | # 28 | # Written by Martin Schulz, schulzm@llnl.gov. 29 | # 30 | # LLNL-CODE-402774 31 | 32 | cmake \ 33 | -D CMAKE_INSTALL_PREFIX=$LOCAL/pnmpi \ 34 | -D CMAKE_BUILD_TYPE=Debug \ 35 | -D CMAKE_CXX_FLAGS="-g -Wall -Werror" \ 36 | .. 37 | -------------------------------------------------------------------------------- /pnmpi-config.h.in: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_CONFIG_H 32 | #define PNMPI_CONFIG_H 33 | 34 | /* Built with Fortran support. */ 35 | #cmakedefine PNMPI_HAVE_FORTRAN 36 | 37 | /* Built with Adept Utils. */ 38 | #define PNMPI_HAVE_ADEPT_UTILS @PnMPI_USE_adept_utils@ 39 | 40 | /* Locations of PnMPI directories in the install tree */ 41 | #define PNMPI_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" 42 | #define PNMPI_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" 43 | #define PNMPI_LIBRARY_DIR "@CMAKE_INSTALL_PREFIX@/lib" 44 | #define PNMPI_MODULES_DIR "@PnMPI_MODULES_DIR@" 45 | 46 | /* PnMPI version information -- numerical and a version string. */ 47 | #define PNMPI_MAJOR_VERSION @PNMPI_VERSION_MAJOR@ 48 | #define PNMPI_MINOR_VERSION @PNMPI_VERSION_MINOR@ 49 | #define PNMPI_PATCH_VERSION @PNMPI_VERSION_PATCH@ 50 | #define PNMPI_TWEAK_VERSION @PNMPI_VERSION_TWEAK@ 51 | #define PNMPI_VERSION "@PNMPI_VERSION@" 52 | 53 | /* define the array size of fortran MPI_Status, TODO: replace with call to fortran snippet */ 54 | #ifdef MPI_STATUS_SIZE 55 | /* many mpi implementations provide the value in C. The standard states "Fortran only" */ 56 | #define PNMPI_F_STATUS_SIZE MPI_STATUS_SIZE 57 | #else 58 | /* here some fortran code should be called to get the actual value */ 59 | #define PNMPI_F_STATUS_SIZE 6 60 | #endif 61 | 62 | 63 | #endif // PNMPI_CONFIG_H 64 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(PnMPI_headers) 31 | 32 | 33 | # Include common include directories. 34 | # 35 | # As almost all source code files need any kind of PnMPI header to be included, 36 | # the common PnMPI header path will be included for all subdirectories instead 37 | # of including the path independently in all paths. 38 | include_directories(${PNMPI_HEADER_DIR}) 39 | 40 | 41 | add_subdirectory(modules) 42 | add_subdirectory(patch) 43 | add_subdirectory(pnmpi) 44 | add_subdirectory(pnmpize) 45 | -------------------------------------------------------------------------------- /src/modules/comm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | #Set names for targets 31 | set(PREFIX commsub) 32 | set(SUBMODULES print empty) 33 | # TODO: checksum removed due to incompatibility with OpenMPI 34 | 35 | #Loop over all targets (submods) 36 | foreach(mod ${SUBMODULES}) 37 | # Use macro to: add target for module, version it, install it, patch it 38 | set(modulename ${PREFIX}-${mod}) 39 | pnmpi_add_pmpi_module(${modulename} ${modulename}.cpp comm.c) 40 | 41 | # Add the submodname define as a flag 42 | ## TODO: Martin, please have a look at the "SUBMODNAME" define, is that what you want ??? 43 | set_source_files_properties(${modulename}.cpp COMPILE_FLAGS "-DSUBMODNAME='\"${mod}\"'") 44 | 45 | install(TARGETS ${modulename} DESTINATION ${PnMPI_MODULES_DIR}) 46 | endforeach() 47 | 48 | include_directories( 49 | ${PROJECT_SOURCE_DIR}/src/modules/datatype 50 | ${PROJECT_SOURCE_DIR}/src/modules/requests 51 | ${PROJECT_SOURCE_DIR}/src/modules/status 52 | ) 53 | -------------------------------------------------------------------------------- /src/modules/datatype/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(GNUInstallDirs) 31 | 32 | 33 | pnmpi_add_pmpi_module(datatype datatype.cpp) 34 | pnmpi_add_pmpi_module(dtprint dtprint.c) 35 | 36 | #Add header to intermediate include dir 37 | install(FILES datatype.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) 38 | install(TARGETS datatype dtprint DESTINATION ${PnMPI_MODULES_DIR}) 39 | -------------------------------------------------------------------------------- /src/modules/empty/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | pnmpi_add_pmpi_module(empty empty.c) 31 | add_wrapped_file(empty.c empty.w -w) 32 | 33 | install(TARGETS empty DESTINATION ${PnMPI_MODULES_DIR}) 34 | 35 | include_directories(${MPI_C_INCLUDE_PATH}) 36 | -------------------------------------------------------------------------------- /src/modules/empty/empty.w: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | 33 | 34 | /* Below code is automatically generated. */ 35 | {{fnall fn_name MPI_Pcontrol}} 36 | {{callfn}} 37 | {{endfnall}} 38 | -------------------------------------------------------------------------------- /src/modules/limit-threading/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(CheckMPIFunctionExists) 31 | 32 | 33 | # Check if MPI_Init_thread is available for C. Otherwise this module can't be 34 | # compiled and will be ignored. 35 | check_mpi_function_exists(MPI_Init_thread HAVE_MPI_INIT_THREAD_C) 36 | if (NOT HAVE_MPI_INIT_THREAD_C) 37 | return() 38 | endif() 39 | 40 | pnmpi_add_xmpi_module(limit-threading limit-threading.c) 41 | 42 | pnmpi_add_module_man(limit-threading module_limit_threading) 43 | 44 | install(TARGETS limit-threading DESTINATION ${PnMPI_MODULES_DIR}) 45 | -------------------------------------------------------------------------------- /src/modules/metrics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(PnMPI_doc) 31 | 32 | 33 | # Add C11 flags, if C11 is available. 34 | if (C11_FOUND) 35 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C11_FLAGS}") 36 | endif () 37 | 38 | # Check if atomics are available for thread safe storage. First we try to use 39 | # C11 atomics, next the GCC builtin atomic_fetch_add method and finally 40 | # sync_fetch_and_add. 41 | if (NOT C11_ATOMICS_FOUND) 42 | find_package(BuiltinAtomic) 43 | if (NOT BUILTINATOMIC_FOUND) 44 | find_package(BuiltinSync) 45 | endif () 46 | endif () 47 | 48 | configure_file(config.h.in config.h) 49 | 50 | 51 | include_directories( 52 | ${CMAKE_CURRENT_SOURCE_DIR} # Required for generated source files. 53 | ${CMAKE_CURRENT_BINARY_DIR} 54 | ) 55 | 56 | 57 | # 58 | # Add the counter module 59 | # 60 | add_wrapped_file(counter.c counter.c.w -w) 61 | pnmpi_add_xmpi_module(metrics-counter "${CMAKE_CURRENT_BINARY_DIR}/counter.c") 62 | 63 | pnmpi_add_module_man(metrics-counter module_metrics_counter) 64 | 65 | install(TARGETS metrics-counter DESTINATION ${PnMPI_MODULES_DIR}) 66 | 67 | 68 | # 69 | # Add the timing module. 70 | # 71 | find_package(hires-timers) 72 | if (HIRES_TIMERS_FOUND) 73 | include_directories(${HIRES_TIMERS_INCLUDE_DIRS}) 74 | 75 | add_wrapped_file(timing.c timing.c.w -w) 76 | pnmpi_add_xmpi_module(metrics-timing "${CMAKE_CURRENT_BINARY_DIR}/timing.c") 77 | target_link_libraries(metrics-timing ${HIRES_TIMERS_LIBRARIES}) 78 | 79 | pnmpi_add_module_man(metrics-timing module_metrics_timing) 80 | 81 | install(TARGETS metrics-timing DESTINATION ${PnMPI_MODULES_DIR}) 82 | endif () 83 | -------------------------------------------------------------------------------- /src/modules/metrics/config.h.in: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef METRICS_CONFIG_H 32 | #define METRICS_CONFIG_H 33 | 34 | 35 | #cmakedefine C11_ATOMICS_FOUND 36 | #cmakedefine BUILTINATOMIC_FOUND 37 | #cmakedefine BUILTINSYNC_FOUND 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/modules/piggyback/Makefile: -------------------------------------------------------------------------------- 1 | include $(PNMPIBASE)/common/Makefile.common 2 | 3 | MOD = pbdriver.so \ 4 | pb_datatype1.so pb_datatype2.so \ 5 | pb_twomsg1.so pb_twomsg2.so \ 6 | pb_pack1.so pb_pack2.so\ 7 | pb_copy1.so pb_copy2.so 8 | HEADER = pb_mod.h 9 | 10 | CFLAGS += -I$(PNMPI_INC_PATH) 11 | CCFLAGS += -I$(PNMPI_INC_PATH) 12 | 13 | all: $(MOD) install 14 | 15 | pb_dt.o: 16 | 17 | .SUFFIXES: .c .o .so 18 | 19 | .o.so: 20 | $(CROSSLDXX) -o $@ $(SFLAGS) $< -ma 21 | 22 | .c.o: 23 | $(MPICC) -c $(CFLAGS) $< 24 | 25 | .cpp.o: 26 | $(MPIXX) -c $(CFLAGS) $< 27 | 28 | pb_datatype1.o: piggyback.c 29 | $(MPICC) -c $(CFLAGS) -DPB_DATATYPE1 $< 30 | mv piggyback.o pb_datatype1.o 31 | 32 | pb_datatype2.o: piggyback.c 33 | $(MPICC) -c $(CFLAGS) -DPB_DATATYPE2 $< 34 | mv piggyback.o pb_datatype2.o 35 | 36 | pb_twomsg1.o: piggyback.c 37 | $(MPICC) -c $(CFLAGS) -DPB_TWOMSG1 $< 38 | mv piggyback.o pb_twomsg1.o 39 | 40 | pb_twomsg2.o: piggyback.c 41 | $(MPICC) -c $(CFLAGS) -DPB_TWOMSG2 $< 42 | mv piggyback.o pb_twomsg2.o 43 | 44 | pb_pack1.o: piggyback.c 45 | $(MPICC) -c $(CFLAGS) -DPB_PACK1 $< 46 | mv piggyback.o pb_pack1.o 47 | 48 | pb_pack2.o: piggyback.c 49 | $(MPICC) -c $(CFLAGS) -DPB_PACK2 $< 50 | mv piggyback.o pb_pack2.o 51 | 52 | pb_copy1.o: piggyback.c 53 | $(MPICC) -c $(CFLAGS) -DPB_COPY1 $< 54 | mv piggyback.o pb_copy1.o 55 | 56 | pb_copy2.o: piggyback.c 57 | $(MPICC) -c $(CFLAGS) -DPB_COPY2 $< 58 | mv piggyback.o pb_copy2.o 59 | 60 | 61 | install: $(MOD) 62 | for mymod in $(MOD); do ($(LOCAL)/pnmpi/bin/patch $$mymod $(PNMPI_LIB_PATH)/$$mymod ); done 63 | for myheader in $(HEADER); do ( cp $$myheader $(PNMPI_INC_PATH)/$$myheader ); done 64 | 65 | clean: 66 | rm -f $(MOD) *.o 67 | 68 | clobber: clean 69 | rm -f *~ 70 | for mymod in $(MOD); do ( rm $(PNMPI_LIB_PATH)/$$mymod ); done 71 | 72 | -------------------------------------------------------------------------------- /src/modules/piggyback/pb_mod.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifndef _PNMPI_MOD_PIGGYBACK 5 | #define _PNMPI_MOD_PIGGYBACK 6 | 7 | #define PNMPI_MODULE_PB "piggyback" 8 | 9 | 10 | /*..........................................................*/ 11 | /* Request additional memory in the status object 12 | This must be called from within MPI_Init (after 13 | calling PMPI_Init) 14 | 15 | IN: size = number of bytes requested 16 | (if 0, just storage of standard parameters 17 | OUT: >=0: offset of new storage relative to request pointer 18 | <0: error message 19 | */ 20 | 21 | 22 | typedef int (*PNMPIMOD_Piggyback_t)(int,char*); 23 | typedef int (*PNMPIMOD_Piggyback_Size_t)(int); 24 | 25 | #endif /* _PNMPI_MOD_STATUS */ 26 | -------------------------------------------------------------------------------- /src/modules/piggyback/ping/.pnmpi-conf: -------------------------------------------------------------------------------- 1 | module status 2 | module datatype 3 | module pbdriver 4 | argument size 4 5 | argument set 1 6 | argument check 0 7 | module pb_datatype1 8 | module requests 9 | -------------------------------------------------------------------------------- /src/modules/piggyback/ping/Makefile: -------------------------------------------------------------------------------- 1 | include $(PNMPIBASE)/common/Makefile.common 2 | 3 | #TARGET = local loader 4 | TARGET = pingpong pingpong-pn pingpongdt pingpong1dt datacreate 5 | 6 | ifeq ($(findstring AIX,$(OS)),AIX) 7 | PNMPILIB = $(PNMPI_LIB_PATH)/libpnmpi.so $(PNMPI_LIB_PATH)/forcempi.a 8 | LFLAGS += -brtl 9 | else 10 | PNMPILIB = $(PNMPI_LIB_PATH)/libpnmpi.so 11 | #LFLAGS += -lunwind 12 | endif 13 | 14 | HERE = $(PWD) 15 | 16 | all: $(TARGET) 17 | 18 | pingpong: pingpong.o 19 | $(MPICC) -o $@ $(LFLAGS) $< 20 | 21 | pingpongdt: pingpongdt.o 22 | $(MPICC) -o $@ $(LFLAGS) $< 23 | 24 | pingpong1dt: pingpong1dt.o 25 | $(MPICC) -o $@ $(LFLAGS) $< 26 | 27 | datacreate: datacreate.o 28 | $(MPICC) -o $@ $(LFLAGS) $< 29 | 30 | pingpong-pn: $(PNMPILIB) pingpong.o 31 | $(MPICC) -o $@ $(LFLAGS) pingpong.o -L$(PNMPI_LIB_PATH) -lpnmpi 32 | 33 | pingpong.o: pingpong.c 34 | $(MPICC) -c $(CFLAGS) $< 35 | 36 | pingpongdt.o: pingpongdt.c 37 | $(MPICC) -c $(CFLAGS) $< 38 | 39 | pingpong1dt.o: pingpong1dt.c 40 | $(MPICC) -c $(CFLAGS) $< 41 | 42 | datacreate.o: datacreate.c 43 | $(MPICC) -c $(CFLAGS) $< 44 | 45 | nocore: 46 | rm -f *.core *v3breakpoints 47 | 48 | clean: nocore 49 | rm -f $(TARGET) $(MPIPTARGET) *.o 50 | 51 | clobber: clean 52 | rm -f *~ *.?.mpiP *core 53 | -------------------------------------------------------------------------------- /src/modules/piggyback/ping/getus.h: -------------------------------------------------------------------------------- 1 | #ifndef __MPID_GETUS 2 | #define __MPID_GETUS 3 | 4 | 5 | #ifdef _WIN32 6 | #include 7 | #define GETTICKS(t) QueryPerformanceCounter((LARGE_INTEGER*)t); 8 | 9 | #else 10 | /* binding for an assembler subroutine to read processor clocks 11 | on x86 CPUs via the rdtsc command */ 12 | 13 | /* CLOCK is the clock frequency of the processor - it has to be 14 | set according to the current configuration to the CPU frequency 15 | in 1e+7 Hz, i.e. for 450 MHz the setting would be 45 */ 16 | #define CLOCK 45 17 | 18 | void gettime(long long *us); 19 | /* this macro returns a number of CPU ticks */ 20 | #define GETTICKS(t) gettime(t) 21 | 22 | 23 | /* Sun cc */ 24 | #ifdef __SUNPRO_C 25 | 26 | /* get processor ticks */ 27 | void getticks(long long *us); 28 | #pragma inline (getticks); 29 | 30 | #else 31 | /* Gnu gcc */ 32 | #ifdef X86 33 | #define GETTICKS(t) asm volatile ("push %%esi\n\t" "mov %0, %%esi" : : "r" (t)); \ 34 | asm volatile ("push %eax\n\t" "push %edx"); \ 35 | asm volatile ("rdtsc"); \ 36 | asm volatile ("movl %eax, (%esi)\n\t" "movl %edx, 4(%esi)"); \ 37 | asm volatile ("pop %edx\n\t" "pop %eax\n\t" "pop %esi"); 38 | #endif /* X86 */ 39 | 40 | #endif /* SUNPRO_C */ 41 | 42 | #define GETUS(t) GETTICKS(t); 43 | 44 | #ifdef X86 45 | /* this macro returns a time stamp as a multiple of 100ns */ 46 | #define GETUS(ts) GETTICKS(ts); \ 47 | *ts /= CLOCK; 48 | #endif /* X86 */ 49 | 50 | #endif /* _WIN32 */ 51 | 52 | #endif /* __MPID_GETUS */ 53 | -------------------------------------------------------------------------------- /src/modules/requests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(GNUInstallDirs) 31 | 32 | 33 | #Use macro to: add target for module, version it, install it, patch it 34 | pnmpi_add_pmpi_module(requests requests.cpp) 35 | 36 | #Add header to intermediate include dir 37 | install(FILES requests.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) 38 | install(TARGETS requests DESTINATION ${PnMPI_MODULES_DIR}) 39 | 40 | include_directories(${PROJECT_SOURCE_DIR}/src/modules/status) 41 | -------------------------------------------------------------------------------- /src/modules/sample/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | #modules to build: 31 | set(MODS sample1 sample2 sample3 sample4 sample1f) 32 | 33 | #loop over modules and build them 34 | foreach(mod ${MODS}) 35 | #Use macro to: add target for module, version it, install it, patch it 36 | pnmpi_add_pmpi_module(${mod} ${mod}.c) 37 | install(TARGETS ${mod} DESTINATION ${PnMPI_MODULES_DIR}) 38 | endforeach() 39 | 40 | # Create special non-patched version of sample1 (as SHARED and not as MODULE) 41 | # Used as part of the demo to show simple preloading of PMPI libraries. 42 | add_library(sample1-non-patched SHARED sample1.c) 43 | target_link_libraries(sample1-non-patched ${MPI_C_LIBRARIES}) 44 | -------------------------------------------------------------------------------- /src/modules/sample/sample1.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | 38 | int MPI_Send(PNMPI_CONST void *buf, int num, MPI_Datatype dtype, int node, 39 | int tag, MPI_Comm comm) 40 | { 41 | int res; 42 | 43 | printf("WRAPPER 1: Before send\n"); 44 | fflush(stdout); 45 | 46 | res = PMPI_Send(buf, num, dtype, node, tag, comm); 47 | 48 | printf("WRAPPER 1: After send\n"); 49 | fflush(stdout); 50 | 51 | return res; 52 | } 53 | 54 | int MPI_Recv(void *buf, int num, MPI_Datatype dtype, int node, int tag, 55 | MPI_Comm comm, MPI_Status *status) 56 | { 57 | int res; 58 | 59 | printf("WRAPPER 1: Before recv\n"); 60 | fflush(stdout); 61 | 62 | res = PMPI_Recv(buf, num, dtype, node, tag, comm, status); 63 | 64 | printf("WRAPPER 1: After recv\n"); 65 | fflush(stdout); 66 | 67 | return res; 68 | } 69 | -------------------------------------------------------------------------------- /src/modules/sample/sample1f.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | 37 | void mpi_send_(void *buf, int *num, MPI_Datatype *dtype, int *node, int *tag, 38 | MPI_Comm *comm, int *ierr) 39 | { 40 | printf("WRAPPER 1: Before send\n"); 41 | fflush(stdout); 42 | 43 | *ierr = PMPI_Send(buf, *num, *dtype, *node, *tag, *comm); 44 | 45 | printf("WRAPPER 1: After send\n"); 46 | fflush(stdout); 47 | 48 | return; 49 | } 50 | 51 | void mpi_recv_(void *buf, int *num, MPI_Datatype *dtype, int *node, int *tag, 52 | MPI_Comm *comm, MPI_Status *status, int *ierr) 53 | { 54 | printf("WRAPPER 1: Before recv\n"); 55 | fflush(stdout); 56 | 57 | *ierr = PMPI_Recv(buf, *num, *dtype, *node, *tag, *comm, status); 58 | 59 | printf("WRAPPER 1: After recv\n"); 60 | fflush(stdout); 61 | 62 | return; 63 | } 64 | -------------------------------------------------------------------------------- /src/modules/sample/sample2.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | 38 | int MPI_Send(PNMPI_CONST void *buf, int num, MPI_Datatype dtype, int node, 39 | int tag, MPI_Comm comm) 40 | { 41 | int res; 42 | 43 | printf("WRAPPER 2: Before send\n"); 44 | fflush(stdout); 45 | 46 | res = PMPI_Send(buf, num, dtype, node, tag, comm); 47 | 48 | printf("WRAPPER 2: After send\n"); 49 | fflush(stdout); 50 | 51 | return res; 52 | } 53 | -------------------------------------------------------------------------------- /src/modules/sample/sample3.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | 37 | int MPI_Recv(void *buf, int num, MPI_Datatype dtype, int node, int tag, 38 | MPI_Comm comm, MPI_Status *status) 39 | { 40 | int res; 41 | 42 | printf("WRAPPER 3: Before recv\n"); 43 | fflush(stdout); 44 | 45 | res = PMPI_Recv(buf, num, dtype, node, tag, comm, status); 46 | 47 | printf("WRAPPER 3: After recv\n"); 48 | fflush(stdout); 49 | 50 | return res; 51 | } 52 | -------------------------------------------------------------------------------- /src/modules/sample/sample4.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | 38 | int MPI_Send(PNMPI_CONST void *buf, int num, MPI_Datatype dtype, int node, 39 | int tag, MPI_Comm comm) 40 | { 41 | int res; 42 | 43 | printf("WRAPPER 4: Before send\n"); 44 | fflush(stdout); 45 | 46 | res = PMPI_Send(buf, num, dtype, node, tag, comm); 47 | 48 | printf("WRAPPER 4: After send\n"); 49 | fflush(stdout); 50 | 51 | return res; 52 | } 53 | 54 | int MPI_Recv(void *buf, int num, MPI_Datatype dtype, int node, int tag, 55 | MPI_Comm comm, MPI_Status *status) 56 | { 57 | int res; 58 | 59 | printf("WRAPPER 4: Before recv\n"); 60 | fflush(stdout); 61 | 62 | res = PMPI_Recv(buf, num, dtype, node, tag, comm, status); 63 | 64 | printf("WRAPPER 4: After recv\n"); 65 | fflush(stdout); 66 | 67 | return res; 68 | } 69 | -------------------------------------------------------------------------------- /src/modules/status/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(GNUInstallDirs) 31 | 32 | 33 | #Use macro to: add target for module, version it, install it, patch it 34 | pnmpi_add_pmpi_module(status status.c) 35 | 36 | #Add header to intermediate include dir 37 | install(FILES status.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) 38 | install(TARGETS status DESTINATION ${PnMPI_MODULES_DIR}) 39 | -------------------------------------------------------------------------------- /src/modules/switch-matrix/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | #Use macro to: add target for module, version it, install it, patch it 31 | pnmpi_add_pmpi_module(switch-matrix switch-matrix.c) 32 | add_wrapped_file(switch-matrix.c switch-matrix.w -w) 33 | 34 | install(TARGETS switch-matrix DESTINATION ${PnMPI_MODULES_DIR}) 35 | -------------------------------------------------------------------------------- /src/modules/timelapse/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(GNUInstallDirs) 31 | 32 | 33 | #Use macro to: add target for module, version it, install it, patch it 34 | pnmpi_add_xmpi_module(timelapse timelapse.c) 35 | 36 | #Add header to intermediate include dir 37 | install(FILES timelapse.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) 38 | install(TARGETS timelapse DESTINATION ${PnMPI_MODULES_DIR}) 39 | -------------------------------------------------------------------------------- /src/modules/timelapse/timelapse.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef _PNMPI_MOD_TIMELAPSE 32 | #define _PNMPI_MOD_TIMELAPSE 33 | 34 | 35 | #include 36 | 37 | 38 | /*------------------------------------------------------------*/ 39 | /* Note: this module must be loaded into the stack before 40 | any module using it (i.e., must be instantiated between 41 | any user and the application). Also, any call to its 42 | services must occur after calling PMPI_Init and services 43 | are only available to modules requesting it during 44 | MPI_Init */ 45 | 46 | /*------------------------------------------------------------*/ 47 | /* Additional storage in requests */ 48 | 49 | #define PNMPI_MODULE_TIMELAPSE "timelapse" 50 | 51 | 52 | /*..........................................................*/ 53 | /* Start at stop timer */ 54 | 55 | typedef int (*PNMPIMOD_Timelapse_Switch_t)(int); 56 | int PNMPIMOD_Timelapse_Switch(int onoff); 57 | 58 | 59 | #endif /* _PNMPI_MOD_STATUS */ 60 | -------------------------------------------------------------------------------- /src/modules/virtual/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | #Use macro to: add target for module, version it, install it, patch it 31 | pnmpi_add_pmpi_module(virtual virtual.c) 32 | add_wrapped_file(virtual.c virtual.w -w) 33 | 34 | install(TARGETS virtual DESTINATION ${PnMPI_MODULES_DIR}) 35 | -------------------------------------------------------------------------------- /src/modules/wait-for-debugger/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(PnMPI_doc) 31 | 32 | 33 | pnmpi_add_xmpi_module(wait-for-debugger wait-for-debugger.c) 34 | 35 | pnmpi_add_module_man(wait-for-debugger module_wait_for_debugger) 36 | 37 | install(TARGETS wait-for-debugger DESTINATION ${PnMPI_MODULES_DIR}) 38 | -------------------------------------------------------------------------------- /src/patch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(GNUInstallDirs) 31 | 32 | 33 | # Search for libbfd. 34 | # 35 | # NOTE: This tends to break all the time, so it's disabled by default. Using 36 | # libbfd may be deprecated in future releases. 37 | option(PNMPI_ENABLE_BFD "Should the PnMPI patcher use libbfd?" OFF) 38 | if (PNMPI_ENABLE_BFD) 39 | find_package(BFD) 40 | endif () 41 | 42 | 43 | # Generate the patcher's configuration. 44 | # 45 | # Depending on the packages CMake found, a configuration header file will be 46 | # generated for the patcher. 47 | configure_file(config.h.in config.h) 48 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 49 | 50 | 51 | #Add the target for the patcher 52 | SET (PATCHER_FRONTEND_COMPILER "" CACHE FILEPATH "If this is a frontend/backend build use the backend compiler as CMake compilers and specify a frontend compiler here to create a frontend-operating version of the PnMPI patcher.") 53 | 54 | SET (targetName pnmpi-patch) 55 | if (PATCHER_FRONTEND_COMPILER) 56 | SET (targetName backend-pnmpi-patch) 57 | endif() 58 | 59 | add_executable(${targetName} patch.c) 60 | add_coverage(${targetName}) 61 | add_sanitizers(${targetName}) 62 | if (BFD_FOUND) 63 | target_link_libraries(${targetName} ${BFD_LIBRARIES}) 64 | target_link_libraries(${targetName} ${IBERTY_LIBRARIES}) 65 | endif() 66 | install( 67 | TARGETS ${targetName} 68 | EXPORT ${targetName} 69 | RUNTIME 70 | DESTINATION ${CMAKE_INSTALL_BINDIR} 71 | ) 72 | 73 | # Allow patch target to be used by subprojects. 74 | install( 75 | EXPORT ${targetName} 76 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/PnMPI 77 | ) 78 | 79 | 80 | add_subdirectory(frontend) 81 | -------------------------------------------------------------------------------- /src/patch/config.h.in: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_PATCHER_CONFIG_H 32 | #define PNMPI_PATCHER_CONFIG_H 33 | 34 | 35 | #cmakedefine PNMPI_HAVE_BFD 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/patch/frontend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | #Add the target for the patcher 31 | if (PATCHER_FRONTEND_COMPILER) 32 | set(CMAKE_C_COMPILER ${PATCHER_FRONTEND_COMPILER}) 33 | set(CMAKE_C_FLAGS "") 34 | set(CMAKE_C_FLAGS_DEBUG "") 35 | set(CMAKE_BUILD_TYPE "Debug") 36 | set(BFD_FOUND False) 37 | set(DPNMPI_HAVE_BFD False) 38 | 39 | add_executable(pnmpi-patch ../patch.c) 40 | add_coverage(pnmpi-patch) 41 | add_sanitizers(pnmpi-patch) 42 | install(TARGETS pnmpi-patch EXPORT pnmpi-patch RUNTIME DESTINATION bin) 43 | 44 | # Allow patch target to be used by subprojects. 45 | install(EXPORT pnmpi-patch DESTINATION share/cmake/PnMPI) 46 | endif() 47 | 48 | include_directories(${PROJECT_BINARY_DIR}) 49 | -------------------------------------------------------------------------------- /src/pnmpi/compiler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | # NOTE: Compiler features checked inside this directory should be general 31 | # purpose, i.e. reusable at several places inside of PnMPI's source code. 32 | # Compiler features related to a specific function should be tested in the 33 | # relating CMakeLists file instead! 34 | 35 | # Check if thread local storage is available for thread safe variables in PnMPI 36 | # and modules. First we try to use C11 _Thread_local, next the compiler-specific 37 | # builtin __thread keyword. 38 | if (NOT C11_THREAD_LOCAL_FOUND) 39 | find_package(ThreadKeyword) 40 | endif () 41 | 42 | # PnMPI will be built thread safe by default. For performance improvements 43 | # thread local storage may be disabled. 44 | option(ENABLE_THREAD_SAFETY "Selects whether PnMPI is built thread safe." TRUE) 45 | if (NOT ENABLE_THREAD_SAFETY) 46 | set(C11_THREAD_LOCAL_FOUND false) 47 | set(THREADKEYWORD_FOUND false) 48 | endif () 49 | 50 | 51 | # Install and manage the public and private header files of the PnMPI sources. 52 | # This has to be done to use the same headers for the PnMPI sources and the API 53 | # without getting conflicts about the used paths. Otherwise you'd have to take 54 | # care about file locations after installation, especially if you use the 55 | # headers over multiple directories. 56 | pnmpi_add_header(attr_public.h attributes.h) 57 | pnmpi_add_private_header(attr_private.h attributes.h) 58 | pnmpi_add_private_header(features.h.in compiler_features.h) 59 | pnmpi_add_private_header(tls.h tls.h) 60 | -------------------------------------------------------------------------------- /src/pnmpi/compiler/attr_private.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /** \file 32 | * 33 | * \details This file contains compiler-dependent macros, which set function or 34 | * variable attributes for the compiler, if they are supported. 35 | * 36 | * 37 | * \privatesection 38 | */ 39 | 40 | 41 | #ifndef PNMPI_PRIVATE_ATTRIBUTES_H 42 | #define PNMPI_PRIVATE_ATTRIBUTES_H 43 | 44 | 45 | /** \brief Mark function as internal. 46 | * 47 | * \details This macro will be used to mark functions as internal functions, 48 | * which will be hidden for global exports. 49 | */ 50 | #ifdef __GNUC__ 51 | #define PNMPI_INTERNAL __attribute__((visibility("hidden"))) 52 | #else 53 | #define PNMPI_INTERNAL 54 | #endif 55 | 56 | 57 | /** \brief Mark function as possibly unused. 58 | * 59 | * \details When defining static functions inside a header, possibly not all 60 | * functions will be used by all source files including this header. By using 61 | * this macro, the compiler knows about this and will not print a warning about 62 | * an unused function. 63 | */ 64 | #ifdef __GNUC__ 65 | #define PNMPI_UNUSED __attribute__((unused)) 66 | #else 67 | #define PNMPI_UNUSED 68 | #endif 69 | 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/pnmpi/compiler/features.h.in: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_PRIVATE_COMPILER_FEATURES_H 32 | #define PNMPI_PRIVATE_COMPILER_FEATURES_H 33 | 34 | 35 | #cmakedefine C11_THREAD_LOCAL_FOUND 36 | #cmakedefine THREADKEYWORD_FOUND 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/pnmpi/compiler/tls.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | 33 | 34 | /* For some functionality in PnMPI and modules we need thread local storage, 35 | * otherwise storage may be corrupted for MPI applications with concurrent calls 36 | * (MPI threading level MPI_THREAD_MULTIPLE). 37 | * 38 | * We'll try to use C11 threads or the compilers builtin __thread to get 39 | * thread local storage. If thread local storage is not supported by the 40 | * compiler, we'll set the PNMPI_COMPILER_NO_TLS macro, so PnMPI and the modules 41 | * can handle this. */ 42 | 43 | #if defined(C11_THREAD_LOCAL_FOUND) 44 | 45 | #define pnmpi_compiler_tls_keyword _Thread_local 46 | 47 | #elif defined(THREADKEYWORD_FOUND) 48 | 49 | #define pnmpi_compiler_tls_keyword __thread 50 | 51 | #else 52 | 53 | #define PNMPI_COMPILER_NO_TLS 54 | #define pnmpi_compiler_tls_keyword 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/pnmpi/config.h.in: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_PRIVATE_CONFIG_H 32 | #define PNMPI_PRIVATE_CONFIG_H 33 | 34 | 35 | #cmakedefine ENABLE_FORTRAN 36 | 37 | #cmakedefine HAVE_MPI_INIT_THREAD_C 38 | #cmakedefine HAVE_MPI_INIT_THREAD_Fortran 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/pnmpi/debug/print.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* Mark this file as internal header for Doxygen. */ 32 | /// \privatesection 33 | 34 | #ifndef PNMPI_PRIVATE_PRINT_H 35 | #define PNMPI_PRIVATE_PRINT_H 36 | 37 | 38 | #include 39 | #include 40 | 41 | #include 42 | 43 | 44 | int pnmpi_get_rank(void); 45 | 46 | PNMPI_FUNCTION_ARG_NONNULL(1) 47 | PNMPI_FUNCTION_ARG_NONNULL(2) 48 | void pnmpi_print_prefix_rank(FILE *stream, const char *format, va_list ap); 49 | 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/pnmpi/debug/print_warning.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | 38 | /** \brief Print a warning to stderr. 39 | * 40 | * \details This function will print a warning to stderr. The selected debug 41 | * node will be ignored: warnings will be printed at all nodes if they occur. 42 | * 43 | * 44 | * \param format Printf-like format string. 45 | * \param ... Arguments to be evaluated. 46 | * 47 | * 48 | * \hidecallergraph 49 | * \ingroup pnmpi_debug_io 50 | * \private 51 | */ 52 | void pnmpi_print_warning(const char *format, ...) 53 | { 54 | assert(format); 55 | 56 | 57 | /* Print the message with rank as prefix. */ 58 | va_list ap; 59 | va_start(ap, format); 60 | pnmpi_print_prefix_rank(stderr, format, ap); 61 | va_end(ap); 62 | } 63 | -------------------------------------------------------------------------------- /src/pnmpi/finalize.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | 36 | /** \brief Finalize PnMPI. 37 | * 38 | * \note This function must be called as many times as \ref pnmpi_initialize. 39 | * 40 | * \warning PnMPI API functions **MUST NOT** be used after calling this 41 | * function. 42 | * 43 | * 44 | * \private 45 | */ 46 | void pnmpi_finalize(void) 47 | { 48 | /* Ignore any call to this function except the last call. This will be 49 | * achieved by decreasing the initialization counter. If it's zero after 50 | * decreasing, this is the last call to the finalization function and PnMPI 51 | * needs to be finalized now. */ 52 | if (--pnmpi_initialized) 53 | return; 54 | 55 | /* Call the PnMPI finalization functions. These will unload the PnMPI modules 56 | * and free allocated memory. */ 57 | pnmpi_modules_unload(); 58 | } 59 | 60 | 61 | #ifdef __GNUC__ 62 | /** \brief The PnMPI destructor. 63 | * 64 | * \details If the compiler supports destructors, finalize PnMPI in the 65 | * destructor, just before the application finishes. 66 | * 67 | * 68 | * \private 69 | */ 70 | PNMPI_INTERNAL 71 | __attribute__((destructor)) void pnmpi_destructor(void) 72 | { 73 | pnmpi_finalize(); 74 | } 75 | #endif 76 | -------------------------------------------------------------------------------- /src/pnmpi/force_link.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_PRIVATE_FORCE_LINK_H 32 | #define PNMPI_PRIVATE_FORCE_LINK_H 33 | 34 | 35 | void pnmpi_force_link(void); 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/pnmpi/initialization.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_PRIVATE_INITIALIZATION_H 32 | #define PNMPI_PRIVATE_INITIALIZATION_H 33 | 34 | 35 | extern int pnmpi_initialized; 36 | 37 | void pnmpi_initialize(void); 38 | void pnmpi_finalize(void); 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/pnmpi/modules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(PnMPI_doc) 31 | 32 | 33 | # Install and manage the public and private header files of the PnMPI sources. 34 | # This has to be done to use the same headers for the PnMPI sources and the API 35 | # without getting conflicts about the used paths. Otherwise you'd have to take 36 | # care about file locations after installation, especially if you use the 37 | # headers over multiple directories. 38 | pnmpi_add_private_header(modules.h) 39 | pnmpi_add_header(const.h) 40 | pnmpi_add_header(hooks.h) 41 | 42 | # Install the public man pages for this object. 43 | pnmpi_add_man(pnmpi_module_hooks PNMPI_SupportedThreadingLevel) 44 | pnmpi_add_man(pnmpi_module_hooks PNMPI_ModuleName) 45 | pnmpi_add_man(pnmpi_module_hooks PNMPI_RegistrationPoint) 46 | pnmpi_add_man(pnmpi_module_hooks PNMPI_AppStartup) 47 | pnmpi_add_man(pnmpi_module_hooks PNMPI_AppShutdown) 48 | 49 | 50 | easy_add_library(pnmpi_modules OBJECT 51 | call_hook.c 52 | hook_activated.c 53 | unload.c) 54 | 55 | foreach (target pnmpi_modules pnmpi_modules_pic) 56 | add_dependencies(${target} generate) 57 | endforeach () 58 | 59 | add_coverage(pnmpi_modules_pic) 60 | add_sanitizers(pnmpi_modules_pic) 61 | -------------------------------------------------------------------------------- /src/pnmpi/modules/const.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_CONST_H 32 | #define PNMPI_CONST_H 33 | 34 | 35 | #include 36 | 37 | 38 | /** \brief Placeholder for MPI-3 const qualifier. 39 | * 40 | * \details To get PnMPI portable for all versions, some functions need a const 41 | * qualifier for some parameters. This macro may be used instead of it and 42 | * expands to the const qualifier for supported MPI versions. 43 | */ 44 | #if MPI_VERSION == 3 45 | #define PNMPI_CONST const 46 | #else 47 | #define PNMPI_CONST 48 | #endif 49 | 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/pnmpi/modules/hook_activated.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include "core.h" 32 | #include 33 | #include 34 | 35 | 36 | /** \brief Check if \p hook is activated in loaded modules. 37 | * 38 | * \details This function iterates the modules in the current stack and checks, 39 | * if \p hook is defined in any of them. 40 | * 41 | * 42 | * \param hook Name of the hook. 43 | * \param all_modules If set to non-zero, \p hook will be searched in all 44 | * modules, not just those in the current stack. 45 | * 46 | * \return If any module implements the \p hook, a non-zero value will be 47 | * returned, otherwise zero. 48 | * 49 | * 50 | * \private 51 | */ 52 | PNMPI_INTERNAL 53 | int pnmpi_hook_activated(const char *hook, 54 | const enum pnmpi_call_hook_mode all_modules) 55 | { 56 | int i; 57 | for (i = (all_modules == PNMPI_CALL_HOOK_ALL_MODULES) ? 0 : pnmpi_level; 58 | i < modules.num; i++) 59 | { 60 | /* If the current level is a stack delimiter, this level should be 61 | * ignored. If the hook should be searched in all modules, we'll go to the 62 | * next level, otherwise the loop will be exited. */ 63 | if (modules.module[pnmpi_level]->stack_delimiter) 64 | { 65 | if (all_modules == PNMPI_CALL_HOOK_ALL_MODULES) 66 | continue; 67 | else 68 | break; 69 | }; 70 | 71 | if (find_symbol(modules.module[i], hook) != NULL) 72 | return 1; 73 | } 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /src/pnmpi/modules/modules.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_PRIVATE_MODULES_H 32 | #define PNMPI_PRIVATE_MODULES_H 33 | 34 | 35 | #include 36 | #include 37 | 38 | #include "core.h" 39 | 40 | 41 | /** \brief Enum to control different modes of hook functions. 42 | */ 43 | enum pnmpi_call_hook_mode 44 | { 45 | /** \brief Call the hook in the next module of the current stack, only. */ 46 | PNMPI_CALL_HOOK_NEXT_MODULE, 47 | 48 | /** \brief Call the hook in all modules of all stacks. */ 49 | PNMPI_CALL_HOOK_ALL_MODULES, 50 | 51 | /** \brief Call the hook in all modules of the current stack. */ 52 | PNMPI_CALL_HOOK_CURRENT_STACK 53 | }; 54 | 55 | 56 | /** \brief Check if \p handle is a valid module handle. 57 | * 58 | * 59 | * \param handle Module handle to be checked. 60 | * 61 | * \return If \p handle is a valid module handle, a positive integer will be 62 | * returned, otherwise zero. 63 | * 64 | * 65 | * \private 66 | */ 67 | PNMPI_UNUSED 68 | static int pnmpi_valid_modhandle(const PNMPI_modHandle_t handle) 69 | { 70 | return (handle >= 0 && handle < modules.num && 71 | !modules.module[handle]->stack_delimiter); 72 | } 73 | 74 | 75 | void pnmpi_modules_unload(void); 76 | 77 | int pnmpi_hook_activated(const char *hook, 78 | enum pnmpi_call_hook_mode all_modules); 79 | void pnmpi_call_hook(const char *hook, enum pnmpi_call_hook_mode all_modules, 80 | PNMPI_modHandle_t start_level); 81 | 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /src/pnmpi/modules/unload.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | 35 | /** \brief Unload all modules. 36 | * 37 | * 38 | * \private 39 | */ 40 | PNMPI_INTERNAL 41 | void pnmpi_modules_unload(void) 42 | { 43 | /* Trigger the PNMPI_Fini hook in all modules, so they may do some 44 | * finalization steps before they will be unloaded. */ 45 | pnmpi_call_hook("PNMPI_Fini", PNMPI_CALL_HOOK_ALL_MODULES, 0); 46 | 47 | /* Trigger the PNMPI_Unregister hook in all modules, so they may destruct 48 | * initialized objects and free allocated memory. In contrast to the 49 | * PNMPI_Fini hook above, the modules are not allowed to talk to each other in 50 | * this hook, as there is no guaranty, that other hooks still exist. */ 51 | pnmpi_call_hook("PNMPI_UnregistrationPoint", PNMPI_CALL_HOOK_ALL_MODULES, 0); 52 | } 53 | -------------------------------------------------------------------------------- /src/pnmpi/newstack.h.w: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_NEWSTACK_H 32 | #define PNMPI_NEWSTACK_H 33 | 34 | 35 | #include 36 | 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | {{forallfn fn_name MPI_Pcontrol}} 43 | {{retType}} P{{fn_name}}_NewStack({{list "PNMPI_modHandle_t stack" {{formals}}}}); 44 | {{endforallfn}} 45 | 46 | {{forallfn fn_name MPI_Pcontrol}} 47 | {{ret_type}} X{{fn_name}}_NewStack({{list "PNMPI_modHandle_t stack" {{formals}}}}); 48 | {{endforallfn}} 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | #endif 54 | -------------------------------------------------------------------------------- /src/pnmpi/pmpi.h.w: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This wrapper will be used for PMPI functions, as some MPI implementations 32 | * define not all PMPI- for all available MPI-functions. */ 33 | 34 | #ifndef PNMPI_PRIVATE_PMPI_H 35 | #define PNMPI_PRIVATE_PMPI_H 36 | 37 | 38 | #include 39 | #include 40 | 41 | 42 | {{forallfn fn_name}} 43 | {{ret_type}} P{{fn_name}}({{formals}}); 44 | {{endforallfn}} 45 | 46 | 47 | /* If PnMPI will be compiled for the Fortran MPI interface, definitions for the 48 | * used Fortran PMPI functions are also required. */ 49 | #ifdef ENABLE_FORTRAN 50 | 51 | void pmpi_init_(int *ierror); 52 | 53 | #ifdef HAVE_MPI_INIT_THREAD_Fortran 54 | void pmpi_init_thread_(int *required, int *provided, int *ierror); 55 | #endif 56 | 57 | void pmpi_finalize_(int *ierror); 58 | 59 | #endif 60 | 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/pnmpi/pnmpi.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* Public interface for PNMPI */ 32 | /* To be used by applications that are aware of PNMPI */ 33 | 34 | #include 35 | 36 | #include "pnmpi-config.h" 37 | #include "pnmpimod.h" 38 | 39 | #define PNMPI_PCONTROL_LEVEL 3 40 | 41 | #define PNMPI_PCONTROL_SINGLE 0x0 42 | #define PNMPI_PCONTROL_MULTIPLE 0x1 43 | #define PNMPI_PCONTROL_VARG 0x0 44 | #define PNMPI_PCONTROL_PTR 0x2 45 | 46 | #define PNMPI_PCONTROL_PMPI 0 47 | #define PNMPI_PCONTROL_OFF 1 48 | #define PNMPI_PCONTROL_ON 2 49 | #define PNMPI_PCONTROL_PNMPI 3 50 | #define PNMPI_PCONTROL_MIXED 4 51 | #define PNMPI_PCONTROL_INT 5 52 | #define PNMPI_PCONTROL_TYPED 6 53 | 54 | #define PNMPI_PCONTROL_DEFAULT PNMPI_PCONTROL_INT 55 | 56 | #define PNMPI_PCONTROL_TYPE_INT 0 57 | #define PNMPI_PCONTROL_TYPE_LONG 1 58 | #define PNMPI_PCONTROL_TYPE_PTR 2 59 | #define PNMPI_PCONTROL_TYPE_DOUBLE 3 60 | 61 | #define PNMPI_ERROR -1 62 | -------------------------------------------------------------------------------- /src/pnmpi/pnmpimod.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef _PNMPIMOD_HEADER 32 | #define _PNMPIMOD_HEADER 33 | 34 | #include 35 | #include 36 | #include 37 | 38 | 39 | /*===============================================================*/ 40 | /* P^N MPI */ 41 | /* Service header file */ 42 | /* This file needs to be included by any module that explicitly */ 43 | /* is designed to work with P^N MPI and uses its extra services */ 44 | /*===============================================================*/ 45 | 46 | #include "pnmpi-config.h" 47 | #include "pnmpi.h" 48 | #include 49 | 50 | /*===============================================================*/ 51 | /* Error codes */ 52 | 53 | #define MPI_ERROR_MEM MPI_ERR_INTERN 54 | #define MPI_ERROR_PNMPI MPI_ERR_INTERN 55 | 56 | 57 | /*===============================================================*/ 58 | /* Services available for cross module communication */ 59 | 60 | /*------------------------------------------------------------*/ 61 | /* Register modules and services */ 62 | 63 | /*.......................................................*/ 64 | /* Constants */ 65 | 66 | #define PNMPI_MODULE_FILENAMELEN 512 67 | #define PNMPI_MODULE_USERNAMELEN 256 68 | 69 | #define PNMPI_REGISTRATION_POINT "PNMPI_RegistrationPoint" 70 | 71 | #define PNMPI_MAX_MOD 100000 72 | 73 | #define PNMPI_MODHANDLE_NULL -1 74 | 75 | 76 | #endif /* _PNMPIMOD_HEADER */ 77 | -------------------------------------------------------------------------------- /src/pnmpi/service/changeStack.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include "core.h" 32 | #include 33 | 34 | 35 | /** \brief Change the current stack. 36 | * 37 | * \note You should use this function only, if the newstack functions can't be 38 | * used, e.g. if you want to change the stack outside a wrapper function. 39 | * 40 | * 41 | * \param stack The new stack. 42 | * 43 | * \return \ref PNMPI_SUCCESS Stack successfully changed. 44 | * 45 | * 46 | * \ingroup PNMPI_Service_GetStackByName 47 | */ 48 | PNMPI_status_t PNMPI_Service_ChangeStack(const PNMPI_modHandle_t stack) 49 | { 50 | pnmpi_level = stack; 51 | return PNMPI_SUCCESS; 52 | } 53 | -------------------------------------------------------------------------------- /src/pnmpi/service/getFunctionAddress.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2017 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2017 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2017 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | 33 | #include 34 | #include 35 | 36 | 37 | /** \brief Get the MPI function address. 38 | * 39 | * \details When entering a wrapped MPI function, PnMPI will store the address 40 | * of the original MPI function being wrapped. Modules may use this address by 41 | * calling this function to get the origin of the error. 42 | * 43 | * 44 | * \param [out] ptr Pointer where to store the address. 45 | * 46 | * \return \ref PNMPI_SUCCESS The address has been stored into \p ptr. 47 | * 48 | * 49 | * \ingroup PNMPI_Service_GetReturnAddress 50 | */ 51 | PNMPI_status_t PNMPI_Service_GetFunctionAddress(void **ptr) 52 | { 53 | assert(ptr); 54 | 55 | 56 | *ptr = pnmpi_get_function_address(); 57 | return PNMPI_SUCCESS; 58 | } 59 | -------------------------------------------------------------------------------- /src/pnmpi/service/getModuleByName.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | 33 | #include "core.h" 34 | #include 35 | 36 | 37 | /** \brief Find a module by name. 38 | * 39 | * \details This function searches for a module named \p name in the list of 40 | * loaded modules. 41 | * 42 | * 43 | * \param name Name of the module to be searched. 44 | * \param [out] handle Where to store the found module handle. 45 | * 46 | * \return \ref PNMPI_SUCCESS Module was found and handle written to \p handle. 47 | * \return \ref PNMPI_NOMODULE No module with the required name \p name has been 48 | * found. 49 | * 50 | * 51 | * \ingroup PNMPI_Service_GetModuleByName 52 | */ 53 | PNMPI_status_t PNMPI_Service_GetModuleByName(const char *name, 54 | PNMPI_modHandle_t *handle) 55 | { 56 | assert(name); 57 | assert(handle); 58 | 59 | 60 | int i; 61 | for (i = 0; i < modules.num; i++) 62 | if (modules.module[i]->registered) 63 | if (strcmp(modules.module[i]->username, name) == 0) 64 | { 65 | /* Found a module with equal name. The handle will be written to the 66 | * provided pointer and success returned. */ 67 | *handle = i; 68 | return PNMPI_SUCCESS; 69 | } 70 | 71 | /* No module with the required name has been found. */ 72 | return PNMPI_NOMODULE; 73 | } 74 | -------------------------------------------------------------------------------- /src/pnmpi/service/getModuleSelf.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | 33 | #include "core.h" 34 | #include 35 | 36 | 37 | /** \brief Get handle of own module. 38 | * 39 | * \note This function is part of the regular service interface, as it is 40 | * required to use this interface. The self service interface is only for 41 | * functions to query data for the own module, which is provided by the regular 42 | * interface, too. 43 | * 44 | * 45 | * \param handle Where to store the module handle of the calling module. 46 | * 47 | * \return \ref PNMPI_SUCCESS Module handle successfully written to \p handle. 48 | * 49 | * 50 | * \ingroup PNMPI_Service_GetModuleByName 51 | */ 52 | PNMPI_status_t PNMPI_Service_GetModuleSelf(PNMPI_modHandle_t *handle) 53 | { 54 | assert(handle); 55 | 56 | 57 | *handle = pnmpi_level; 58 | return PNMPI_SUCCESS; 59 | } 60 | -------------------------------------------------------------------------------- /src/pnmpi/service/getPcontrol.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | 33 | #include "core.h" 34 | #include 35 | #include 36 | #include 37 | 38 | 39 | /** \brief Get the Pcontrol value of module \p handle. 40 | * 41 | * 42 | * \param handle The module to be checked. 43 | * \param [out] flag Where to store the result. 44 | * 45 | * \return \ref PNMPI_SUCCESS Successfully stored the result in \p flag. 46 | * \return \ref PNMPI_NOMODULE \p handle is no valid module handle. 47 | * 48 | * 49 | * \ingroup PNMPI_Service_GetPcontrol 50 | */ 51 | PNMPI_status_t PNMPI_Service_GetPcontrol(const PNMPI_modHandle_t handle, 52 | int *flag) 53 | { 54 | assert(flag); 55 | 56 | /* Check, if module is available and return an error code, if it's not 57 | * available. 58 | * 59 | * NOTE: This check will NOT be disabled for PNMPI_NO_DEBUG, as it's essential 60 | * for accessing the module by ID below. */ 61 | if (!pnmpi_valid_modhandle(handle)) 62 | return PNMPI_NOMODULE; 63 | 64 | 65 | *flag = modules.module[handle]->pcontrol; 66 | return PNMPI_SUCCESS; 67 | } 68 | 69 | 70 | /** \brief Get the Pcontrol value of the calling module. 71 | * 72 | * 73 | * \return The Pcontrol configuration value of the calling module. 74 | * 75 | * 76 | * \ingroup PNMPI_Service_GetPcontrol 77 | */ 78 | int PNMPI_Service_GetPcontrolSelf(void) 79 | { 80 | return modules.module[pnmpi_level]->pcontrol; 81 | } 82 | -------------------------------------------------------------------------------- /src/pnmpi/service/getReturnAddress.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2017 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2017 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2017 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | 33 | #include 34 | #include 35 | 36 | 37 | /** \brief Get the application's return address. 38 | * 39 | * \details When entering a wrapped MPI function, PnMPI will store the return 40 | * address. Modules may use this address by calling this function to get the 41 | * origin of the error. 42 | * 43 | * 44 | * \param [out] ptr Pointer where to store the return address. 45 | * 46 | * \return \ref PNMPI_SUCCESS The return address has been stored into \p ptr. 47 | * \return \ref PNMPI_NOT_IMPLEMENTED This service is not implemented. 48 | * 49 | * 50 | * \ingroup PNMPI_Service_GetReturnAddress 51 | */ 52 | PNMPI_status_t PNMPI_Service_GetReturnAddress(void **ptr) 53 | { 54 | assert(ptr); 55 | 56 | 57 | /* If the compiler does support accessing the return address, it has been saved 58 | * by accessing the PnMPI wrappers before. Copy the saved return address into 59 | * the pointer supported by the callee and return success. 60 | * 61 | * However, if the compiler doesn't, return an error status code to tell the 62 | * callee this feature isn't implemented. */ 63 | #ifdef HAVE_BUILTIN_RETURN_ADDRESS 64 | *ptr = pnmpi_get_return_address(); 65 | return PNMPI_SUCCESS; 66 | #else 67 | return PNMPI_NOT_IMPLEMENTED; 68 | #endif 69 | } 70 | -------------------------------------------------------------------------------- /src/pnmpi/service/getStackByName.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | 33 | #include "core.h" 34 | #include 35 | 36 | 37 | /** \brief Find a stack by name. 38 | * 39 | * \details This function searches for a stack named \p name in the list of 40 | * loaded modules. 41 | * 42 | * 43 | * \param name Name of the stack to be searched. 44 | * \param [out] handle Where to store the handle of the first module in the 45 | * found stack. 46 | * 47 | * \return \ref PNMPI_SUCCESS Stack was found and handle written to \p handle. 48 | * \return \ref PNMPI_NOSTACK No stack with the required name \p name has been 49 | * found. 50 | * 51 | * 52 | * \ingroup PNMPI_Service_GetStackByName 53 | */ 54 | PNMPI_status_t PNMPI_Service_GetStackByName(const char *name, 55 | PNMPI_modHandle_t *handle) 56 | { 57 | assert(name); 58 | assert(handle); 59 | 60 | 61 | int i; 62 | for (i = 0; i < modules.num; i++) 63 | if (modules.module[i]->stack_delimiter) 64 | if (strcmp(modules.module[i]->name, name) == 0) 65 | { 66 | /* Found a stack with equal name. A handle to the first module in this 67 | * stack will be written into the provided pointer and success 68 | * returned. */ 69 | *handle = i + 1; 70 | return PNMPI_SUCCESS; 71 | } 72 | 73 | /* No stack with the required name has been found. */ 74 | return PNMPI_NOSTACK; 75 | } 76 | -------------------------------------------------------------------------------- /src/pnmpi/service/registerGlobal.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | #include "core.h" 35 | #include 36 | #include 37 | 38 | 39 | /** \brief Register a global. 40 | * 41 | * \details This function registers a new global\p global of the calling module. 42 | * 43 | * 44 | * \param global The global to be registered. 45 | * 46 | * \return \ref PNMPI_SUCCESS Global has been registered successfully. 47 | * \return \ref PNMPI_NOMEM Not enough memory to register global. 48 | * 49 | * 50 | * \ingroup PNMPI_Service_GetGlobalByName 51 | */ 52 | PNMPI_status_t 53 | PNMPI_Service_RegisterGlobal(const PNMPI_Global_descriptor_t *global) 54 | { 55 | assert(global); 56 | 57 | 58 | /* Allocate new memory to store a new global definition in the list of globals 59 | * of this module. */ 60 | module_globlist_p newglobal = 61 | (module_globlist_p)malloc(sizeof(module_globlist_t)); 62 | if (newglobal == NULL) 63 | { 64 | PNMPI_Warning("Can't allocate memory to register global '%s' for module " 65 | "at level %d.\n", 66 | global->name, pnmpi_level); 67 | return PNMPI_NOMEM; 68 | } 69 | 70 | /* Prepend the global to the modules global list. */ 71 | newglobal->desc = *global; 72 | newglobal->next = modules.module[pnmpi_level]->globals; 73 | modules.module[pnmpi_level]->globals = newglobal; 74 | return PNMPI_SUCCESS; 75 | } 76 | -------------------------------------------------------------------------------- /src/pnmpi/service/registerModule.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | #include "core.h" 35 | #include 36 | #include 37 | 38 | 39 | /** \brief Register a module. 40 | * 41 | * \details This function registers the calling module with \p name. 42 | * 43 | * 44 | * \param name The name of the module to be registered. 45 | * 46 | * \return \ref PNMPI_SUCCESS The module has been registered. 47 | * 48 | * 49 | * \ingroup PNMPI_Service_GetModuleByName 50 | */ 51 | PNMPI_status_t PNMPI_Service_RegisterModule(const char *name) 52 | { 53 | assert(name); 54 | 55 | 56 | /* Copy name into the module name buffer. If the name is longer than the 57 | * supplied buffer, a warning will be printed. */ 58 | if (snprintf(modules.module[pnmpi_level]->username, PNMPI_MODULE_USERNAMELEN, 59 | "%s", name) >= PNMPI_MODULE_USERNAMELEN) 60 | PNMPI_Warning("Module name '%s' of module %d was too long.\n", name, 61 | pnmpi_level); 62 | 63 | /* Mark the module as registered. */ 64 | modules.module[pnmpi_level]->registered = 1; 65 | 66 | 67 | return PNMPI_SUCCESS; 68 | } 69 | -------------------------------------------------------------------------------- /src/pnmpi/service/registerService.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | #include "core.h" 35 | #include 36 | #include 37 | 38 | 39 | /** \brief Register a service. 40 | * 41 | * \details This function registers a new service \p service of the calling 42 | * module. 43 | * 44 | * 45 | * \param service The service to be registered. 46 | * 47 | * \return \ref PNMPI_SUCCESS Global has been registered successfully. 48 | * \return \ref PNMPI_NOMEM Not enough memory to register global. 49 | * 50 | * 51 | * \ingroup PNMPI_Service_GetServiceByName 52 | */ 53 | PNMPI_status_t 54 | PNMPI_Service_RegisterService(const PNMPI_Service_descriptor_t *service) 55 | { 56 | assert(service); 57 | 58 | 59 | /* Allocate new memory to store a new global definition in the list of globals 60 | * of this module. */ 61 | module_servlist_p newservice = 62 | (module_servlist_p)malloc(sizeof(module_servlist_t)); 63 | if (newservice == NULL) 64 | { 65 | PNMPI_Warning("Can't allocate memory to register service '%s' for module " 66 | "at level %d.\n", 67 | service->name, pnmpi_level); 68 | return PNMPI_NOMEM; 69 | } 70 | 71 | /* Prepend the service to the modules service list. */ 72 | newservice->desc = *service; 73 | newservice->next = modules.module[pnmpi_level]->services; 74 | modules.module[pnmpi_level]->services = newservice; 75 | return PNMPI_SUCCESS; 76 | } 77 | -------------------------------------------------------------------------------- /src/pnmpi/service/strerror.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | 33 | 34 | /** \brief Look up the error message for error \p err. 35 | * 36 | * \details As the libc function strerror, this function returns the 37 | * corresponding error message for error code \p err. 38 | * 39 | * \note The returned pointer MUST NOT be freed. 40 | * 41 | * 42 | * \param err The error code to convert. 43 | * 44 | * \return Pointer to the error message string. 45 | * 46 | * 47 | * \ingroup PNMPI_Service_strerror 48 | */ 49 | const char *PNMPI_Service_strerror(PNMPI_status_t err) 50 | { 51 | switch (err) 52 | { 53 | case PNMPI_SUCCESS: return "Success"; 54 | case PNMPI_FAILURE: return "Failure"; 55 | case PNMPI_NOMEM: return "Can't allocate memory"; 56 | case PNMPI_NOMODULE: return "Module not found"; 57 | case PNMPI_NOSERVICE: return "Service not found"; 58 | case PNMPI_NOGLOBAL: return "Global not found"; 59 | case PNMPI_SIGNATURE: return "Signatures don't match"; 60 | case PNMPI_NOARG: return "Argument not found"; 61 | case PNMPI_NOSTACK: return "Stack not found"; 62 | case PNMPI_NOT_IMPLEMENTED: return "Service not implemented"; 63 | 64 | default: return "Unknown"; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/pnmpi/wrapper.h.w: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | typedef int (*pnmpi_int_MPI_Pcontrol_t)(int level, ... ); 32 | 33 | void mpi_init_(int *ierr); 34 | double mpi_wtick_(void); 35 | double mpi_wtime_(void); 36 | 37 | {{forallfn fn_name MPI_Pcontrol}} 38 | {{ret_type}} {{sub {{fn_name}} '^MPI_' NQJ_}}({{formals}}); 39 | {{endforallfn}} 40 | 41 | #include 42 | 43 | {{forallfn fn_name}} 44 | #define {{fn_name}}_ID {{fn_num}} 45 | {{endforallfn}} 46 | 47 | {{forallfn fn_name MPI_Pcontrol}} 48 | #define Internal_X{{fn_name}} {{sub {{fn_name}} '^MPI_' NQJ_}} 49 | {{endforallfn}} 50 | 51 | {{forallfn fn_name MPI_Pcontrol}} 52 | typedef {{ret_type}} (*pnmpi_int_{{fn_name}}_t)({{formals}});{{endforallfn}} 53 | 54 | typedef struct pnmpi_functions_d 55 | { 56 | {{forallfn fn_name}} pnmpi_int_{{fn_name}}_t *pnmpi_int_{{fn_name}}; 57 | {{endforallfn}} 58 | } pnmpi_functions_t; 59 | 60 | #define INITIALIZE_ALL_FUNCTION_STACKS(mods) \ 61 | {{forallfn fn_name}}INITIALIZE_FUNCTION_STACK("{{fn_name}}", {{fn_name}}_ID, pnmpi_int_{{fn_name}}_t, pnmpi_int_{{fn_name}}, mods, {{fn_name}});\ 62 | {{endforallfn}} 63 | -------------------------------------------------------------------------------- /src/pnmpi/wrapper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | include(CheckCSourceCompiles) 31 | 32 | 33 | # Check if the compiler supports getting the return address, required by 34 | # pnmpi_return_address_set(). 35 | check_c_source_compiles(" 36 | int main () 37 | { 38 | void *p = __builtin_return_address(0); 39 | return 0; 40 | } 41 | " HAVE_BUILTIN_RETURN_ADDRESS) 42 | 43 | 44 | # Install and manage the public and private header files of the PnMPI sources. 45 | # This has to be done to use the same headers for the PnMPI sources and the API 46 | # without getting conflicts about the used paths. Otherwise you'd have to take 47 | # care about file locations after installation, especially if you use the 48 | # headers over multiple directories. 49 | pnmpi_add_private_header(function_address.h) 50 | pnmpi_add_private_header(mpi_interface.h) 51 | pnmpi_add_private_header(mpi_reentry.h) 52 | pnmpi_add_private_header(return_address.h.in return_address.h) 53 | 54 | easy_add_library(pnmpi_wrapper OBJECT 55 | mpi_interface.c 56 | mpi_reentry.c 57 | return_address.c 58 | function_address.c) 59 | 60 | add_coverage(pnmpi_wrapper_pic) 61 | add_sanitizers(pnmpi_wrapper_pic) 62 | -------------------------------------------------------------------------------- /src/pnmpi/wrapper/function_address.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | 35 | /** \brief The current MPI function address. 36 | * 37 | * \details This variable stores the application's return address. With 38 | * additional tools like `addr2line` this address may be translated into the 39 | * position in the source-code, where the application called the MPI call, e.g. 40 | * to print warnings to the user. 41 | * 42 | * \note This value should not be changed directly by any function, but by using 43 | * the \ref pnmpi_function_address_set and \ref pnmpi_function_address_reset 44 | * functions. 45 | * 46 | * 47 | * \private 48 | */ 49 | PNMPI_INTERNAL 50 | pnmpi_compiler_tls_keyword void *pnmpi_function_address = NULL; 51 | -------------------------------------------------------------------------------- /src/pnmpi/wrapper/function_address.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_PRIVATE_FUNCTION_ADDRESS_H 32 | #define PNMPI_PRIVATE_FUNCTION_ADDRESS_H 33 | 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | 40 | 41 | extern pnmpi_compiler_tls_keyword void *pnmpi_function_address; 42 | 43 | 44 | /** \brief Store the address of the application's MPI function call. 45 | * 46 | * \note If the function address has already been set, a new value will NOT be 47 | * stored. This is required for the Fortran wrapper redirections, as these call 48 | * the C wrappers internal. Remember to reset the function address before 49 | * exiting the wrapper. 50 | * 51 | * 52 | * \private 53 | */ 54 | PNMPI_UNUSED 55 | static void pnmpi_set_function_address(void *addr) 56 | { 57 | if (pnmpi_function_address == NULL) 58 | pnmpi_function_address = (char *)addr; 59 | } 60 | 61 | 62 | 63 | /** \brief Get the function address. 64 | * 65 | * 66 | * \return The address of the original function call currently wrapped. 67 | * 68 | * 69 | * \private 70 | */ 71 | PNMPI_UNUSED 72 | static void *pnmpi_get_function_address(void) 73 | { 74 | return pnmpi_function_address; 75 | } 76 | 77 | 78 | /** \brief Reset the function address. 79 | * 80 | * 81 | * \private 82 | */ 83 | PNMPI_UNUSED 84 | static void pnmpi_reset_function_address(void) 85 | { 86 | pnmpi_function_address = NULL; 87 | } 88 | 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /src/pnmpi/wrapper/mpi_interface.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | 35 | /** \brief MPI interface used for an MPI call. 36 | * 37 | * \details This variable stores the MPI interface used by the application for 38 | * an MPI call. By default the interface is \ref PNMPI_INTERFACE_C, but by 39 | * entering a Fortran MPI wrapper function, this will be set to \ref 40 | * PNMPI_INTERFACE_FORTRAN. 41 | * 42 | * \note This value should not be changed directly by any function, but by using 43 | * the \ref pnmpi_reentry_enter and \ref pnmpi_reentry_exit functions. 44 | * 45 | * 46 | * \private 47 | */ 48 | PNMPI_INTERNAL 49 | pnmpi_mpi_interface pnmpi_used_mpi_interface = PNMPI_INTERFACE_C; 50 | -------------------------------------------------------------------------------- /src/pnmpi/wrapper/mpi_reentry.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | 35 | /** \brief MPI reentry guard. 36 | * 37 | * \details Some MPI implementations send the Fortran MPI calls to the C MPI 38 | * interface. However, some implementations behave erroneous and send these 39 | * calls to the MPI_* functions instead of the PMPI_* ones. This would end in 40 | * duplicate calls of the PnMPI wrappers, so the following variable may be used 41 | * to detect these erroneous redirections. 42 | * 43 | * \note This value should not be changed directly by any function, but by using 44 | * the \ref pnmpi_reentry_enter and \ref pnmpi_reentry_exit functions. 45 | * 46 | * 47 | * \private 48 | */ 49 | PNMPI_INTERNAL 50 | pnmpi_compiler_tls_keyword int pnmpi_mpi_reentry = 0; 51 | -------------------------------------------------------------------------------- /src/pnmpi/wrapper/mpi_reentry.h: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_PRIVATE_MPI_REENTRY_H 32 | #define PNMPI_PRIVATE_MPI_REENTRY_H 33 | 34 | 35 | #include 36 | #include 37 | 38 | 39 | extern pnmpi_compiler_tls_keyword int pnmpi_mpi_reentry; 40 | 41 | 42 | /** \brief Try to enter the reentry-guarded section. 43 | * 44 | * \details This function tries to enter the reentry-guarded section. It may be 45 | * used inside an if-expression to execute code depending on the returned 46 | * status. The default would be to call the PMPI function, if entering the 47 | * section fails. 48 | * 49 | * 50 | * \return If the section could be entered, this expression will be zero, 51 | * otherwise one. 52 | * 53 | * 54 | * \private 55 | */ 56 | PNMPI_UNUSED 57 | static int pnmpi_reentry_enter(void) 58 | { 59 | return (pnmpi_mpi_reentry == 1 || pnmpi_mpi_reentry++); 60 | } 61 | 62 | 63 | /** \brief Leave the reentry-guarded section. 64 | * 65 | * 66 | * \private 67 | */ 68 | PNMPI_UNUSED 69 | static void pnmpi_reentry_exit(void) 70 | { 71 | pnmpi_mpi_reentry = 0; 72 | } 73 | 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /src/pnmpi/wrapper/return_address.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include 32 | #include 33 | 34 | 35 | /** \brief The application's return address. 36 | * 37 | * \details This variable stores the application's return address. With 38 | * additional tools like `addr2line` this address may be translated into the 39 | * position in the source-code, where the application called the MPI call, e.g. 40 | * to print warnings to the user. 41 | * 42 | * \note This value should not be changed directly by any function, but by using 43 | * the \ref pnmpi_return_address_set and \ref pnmpi_return_address_reset 44 | * functions. 45 | * 46 | * 47 | * \private 48 | */ 49 | PNMPI_INTERNAL 50 | pnmpi_compiler_tls_keyword void *pnmpi_return_address = NULL; 51 | -------------------------------------------------------------------------------- /src/pnmpi/xmpi.h.w: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PNMPI_XMPI_H 32 | #define PNMPI_XMPI_H 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | {{forallfn fn_name MPI_Pcontrol}} 39 | {{ret_type}} X{{fn_name}}({{formals}}); 40 | {{endforallfn}} 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/pnmpize/config.h.in: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #cmakedefine ENABLE_FORTRAN 32 | 33 | #define PNMPI_VERSION "@PNMPI_VERSION@" 34 | #define PNMPI_LIBRARY_PATH "@CMAKE_INSTALL_FULL_LIBDIR@" 35 | 36 | #define PNMPIZE_SEARCH_PATHS "@PNMPIZE_SEARCH_PATHS@" 37 | -------------------------------------------------------------------------------- /tests/modules/limit-threading/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | # As the limit-threading module is optional (because it depends on a MPI library 31 | # supporting MPI_Init_thread) check if the module has been built. Otherwise the 32 | # module can't be tested. 33 | if (NOT TARGET limit-threading) 34 | return() 35 | endif() 36 | 37 | 38 | easy_add_test(PREFIX module_limit-threading SOURCES limit-threading.conf 39 | NOBINARY) 40 | -------------------------------------------------------------------------------- /tests/modules/limit-threading/limit-threading.conf: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | # NOTE: The limit-threading module needs further testing for e.g. the argument 31 | # evaluation. However, from the current point of view, testing these 32 | # features is complicated and should be implemented in the future instead. 33 | 34 | PNMPICONF: module limit-threading 35 | 36 | ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 37 | ENVIRONMENT: PNMPI_THREADING_LEVEL=single 38 | RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 2 39 | RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C_THREADED@ @MPIEXEC_POSTFLAGS@ 40 | PASS: Provided:.*0 41 | -------------------------------------------------------------------------------- /tests/modules/metrics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | easy_add_test(PREFIX module_metrics_counter SOURCES counter.conf NOBINARY) 31 | 32 | if (HIRES_TIMERS_FOUND) 33 | easy_add_test(PREFIX module_metrics_timing SOURCES timing.c) 34 | endif () 35 | -------------------------------------------------------------------------------- /tests/modules/metrics/counter.conf: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | PNMPICONF: module metrics-counter 31 | 32 | ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 33 | RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 2 34 | RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 35 | PASS: MPI call stats:\n\n Rank 0:.*1 MPI_Init.*Total:.*2 MPI_Init 36 | -------------------------------------------------------------------------------- /tests/modules/wait-for-debugger/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | easy_add_test(PREFIX module_wait-for-debugger SOURCES wait-for-debugger.conf 31 | NOBINARY) 32 | -------------------------------------------------------------------------------- /tests/modules/wait-for-debugger/wait-for-debugger.conf: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | CONFIGS: print wait message 31 | 32 | PNMPICONF: module wait-for-debugger 33 | 34 | RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 35 | RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 36 | 37 | 38 | # Check if the module prints PID and hostname of the rank. 39 | PASS-print: Rank [0-9]+ at .* has pid [0-9]+. 40 | 41 | # Check if the module waits a given time at startup. 42 | ENVIRONMENT-wait: PNMPI_CONF=@PNMPICONF@ 43 | ENVIRONMENT-wait: WAIT_AT_STARTUP=5 44 | PASS-wait: Waiting for 5 seconds. 45 | 46 | # Check if only one module prints the waiting message. 47 | ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 48 | ENVIRONMENT-message: WAIT_AT_STARTUP=1 49 | FAIL-message: Waiting.*Waiting 50 | -------------------------------------------------------------------------------- /tests/pnmpi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | add_subdirectory(core) 31 | add_subdirectory(debug) 32 | add_subdirectory(service) 33 | add_subdirectory(stacks) 34 | -------------------------------------------------------------------------------- /tests/pnmpi/core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | easy_add_test(PREFIX core_banner SOURCES banner.c) 31 | easy_add_test(PREFIX core_hooks SOURCES hooks.c) 32 | easy_add_test(PREFIX core_module_name SOURCES module_name.c) 33 | easy_add_test(PREFIX core_static_linked SOURCES static_linked.c) 34 | -------------------------------------------------------------------------------- /tests/pnmpi/core/banner.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* The following test cases will be used to check the PnMPI banner for 32 | * correctness. The banner includes some basic information about the loaded 33 | * configuration. */ 34 | 35 | #include 36 | 37 | 38 | void PNMPI_RegistrationPoint() 39 | { 40 | } 41 | 42 | 43 | /* CONFIGS: mpi_interface no_module one_module stack 44 | * 45 | * MODTYPE: XMPI 46 | * 47 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 48 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 49 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 50 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 51 | * 52 | * 53 | * ENVIRONMENT-mpi_interface: 54 | * PASS-mpi_interface: MPI interface: .* 55 | * 56 | * ENVIRONMENT-no_module: 57 | * PASS-no_module: No modules loaded 58 | * 59 | * PNMPICONF-one_module: module @MODNAME@ 60 | * PASS-one_module: Loaded modules:.*Stack default:.*@MODNAME@ \(Pcontrol: 1\) 61 | * 62 | * PNMPICONF-stack: module @MODNAME@\n 63 | * PNMPICONF-stack: stack sample\n 64 | * PNMPICONF-stack: module @MODNAME@\n 65 | * PASS-stack: Loaded modules:.*Stack default:.*Stack sample 66 | */ 67 | -------------------------------------------------------------------------------- /tests/pnmpi/core/hooks.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This test case is used to check if PnMPI hits all hooks in modules. 32 | * 33 | * Note: This test cases check NOT, if the functionality of the specific hooks 34 | * is correct, but only if they are called! 35 | */ 36 | 37 | #include // printf 38 | 39 | #include // PnMPI header to check if the hooks signatures match. 40 | 41 | 42 | #ifndef HOOKNAME 43 | #define HOOKNAME unknown 44 | #endif 45 | 46 | 47 | void HOOKNAME() 48 | { 49 | printf("%s hit.\n", __FUNCTION__); 50 | } 51 | 52 | 53 | /* CONFIGS: RegistrationPoint UnregistrationPoint Init Fini 54 | * 55 | * MODTYPE: XMPI 56 | * 57 | * PNMPICONF: module @MODNAME@ 58 | * 59 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 60 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 61 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 62 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 63 | * 64 | * 65 | * COMPILE_FLAGS-RegistrationPoint: -DHOOKNAME=PNMPI_RegistrationPoint 66 | * PASS-RegistrationPoint: PNMPI_RegistrationPoint hit. 67 | * 68 | * COMPILE_FLAGS-UnregistrationPoint: -DHOOKNAME=PNMPI_UnregistrationPoint 69 | * PASS-UnregistrationPoint: PNMPI_UnregistrationPoint hit. 70 | * 71 | * COMPILE_FLAGS-PNMPI_Init: -DHOOKNAME=PNMPI_Init 72 | * PASS-PNMPI_Init: PNMPI_Init hit. 73 | * 74 | * COMPILE_FLAGS-PNMPI_Fini: -DHOOKNAME=PNMPI_Fini 75 | * PASS-PNMPI_Fini: PNMPI_Fini hit. 76 | */ 77 | -------------------------------------------------------------------------------- /tests/pnmpi/core/module_name.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This test case checks, if PnMPI limits the threading level, if at least one 32 | * module does not support the full threading level of MPI. */ 33 | 34 | #include 35 | 36 | 37 | const char *PNMPI_ModuleName = "foobar"; 38 | 39 | 40 | /* MODTYPE: XMPI 41 | * 42 | * PNMPICONF: module @MODNAME@ 43 | * 44 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 45 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 46 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 47 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 48 | * PASS: registered as: foobar 49 | */ 50 | -------------------------------------------------------------------------------- /tests/pnmpi/core/static_linked.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This test case checks, if PnMPI is able to call modules, if it is linked 32 | * statically to the application. */ 33 | 34 | #include 35 | 36 | #include 37 | 38 | 39 | void PNMPI_RegistrationPoint() 40 | { 41 | printf("foo\n"); 42 | } 43 | 44 | 45 | /* MODTYPE: XMPI 46 | * 47 | * PNMPICONF: module @MODNAME@\n 48 | * PNMPICONF: module @MODNAME@\n 49 | * PNMPICONF: module @MODNAME@ 50 | * 51 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 52 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 53 | * ENVIRONMENT: PNMPI_BE_SILENT=1 54 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 @MPIEXEC_PREFLAGS@ 55 | * RUN: @TESTBIN_MPI_C_STATIC@ @MPIEXEC_POSTFLAGS@ 56 | * PASS: foo\nfoo\nfoo\n 57 | */ 58 | -------------------------------------------------------------------------------- /tests/pnmpi/debug/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | easy_add_test(PREFIX "debug_message_prefix" SOURCES message_prefix.c) 31 | -------------------------------------------------------------------------------- /tests/pnmpi/debug/message_prefix.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #ifndef PRINT_DEFAULT 32 | #define PNMPI_MESSAGE_PREFIX "testmodule" 33 | #endif 34 | 35 | #ifdef PNMPI_NO_DEBUG 36 | #undef PNMPI_NO_DEBUG 37 | #endif 38 | 39 | 40 | #include 41 | #include 42 | 43 | 44 | void PNMPI_RegistrationPoint() 45 | { 46 | #ifdef PRINT_DEBUG 47 | PNMPI_Debug(PNMPI_DEBUG_MODULE, "debug\n"); 48 | #endif 49 | 50 | #ifdef PRINT_WARNING 51 | PNMPI_Warning("warning\n"); 52 | #endif 53 | 54 | #ifdef PRINT_ERROR 55 | PNMPI_Error("error\n"); 56 | #endif 57 | } 58 | 59 | 60 | /* CONFIGS: default debug warning error 61 | * 62 | * MODTYPE: XMPI 63 | * 64 | * PNMPICONF: module @MODNAME@\n 65 | * 66 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 67 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 68 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 69 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 70 | * 71 | * 72 | * COMPILE_FLAGS-default: -DPRINT_DEFAULT -DPRINT_WARNING 73 | * PASS-default: \[PnMPI\] warning 74 | * 75 | * COMPILE_FLAGS-debug: -DPRINT_DEBUG 76 | * ENVIRONMENT-debug: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 77 | * ENVIRONMENT-debug: PNMPI_CONF=@PNMPICONF@ 78 | * ENVIRONMENT-debug: PNMPI_DBGLEVEL=2 79 | * PASS-debug: \[testmodule\] debug 80 | * 81 | * COMPILE_FLAGS-warning: -DPRINT_WARNING 82 | * PASS-warning: \[testmodule\] warning 83 | * 84 | * COMPILE_FLAGS-error: -DPRINT_ERROR 85 | * PASS-error: \[testmodule\] .*:[0-9]+: error 86 | */ 87 | -------------------------------------------------------------------------------- /tests/pnmpi/service/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | easy_add_test(PREFIX "service_registerModule" SOURCES registerModule.c) 31 | easy_add_test(PREFIX "service_getModuleSelf" SOURCES getModuleSelf.c) 32 | easy_add_test(PREFIX "service_getModuleByName" SOURCES getModuleByName.c) 33 | 34 | easy_add_test(PREFIX "service_getStackByName" SOURCES getStackByName.c) 35 | 36 | easy_add_test(PREFIX "service_registerGlobal" SOURCES registerGlobal.c) 37 | easy_add_test(PREFIX "service_getGlobalByName" SOURCES getGlobalByName.c) 38 | 39 | easy_add_test(PREFIX "service_registerService" SOURCES registerService.c) 40 | easy_add_test(PREFIX "service_getServiceByName" SOURCES getServiceByName.c) 41 | 42 | easy_add_test(PREFIX "service_getArgument" SOURCES getArgument.c) 43 | easy_add_test(PREFIX "service_getArgumentSelf" SOURCES getArgumentSelf.c) 44 | 45 | easy_add_test(PREFIX "service_getPcontrol" SOURCES getPcontrol.c) 46 | easy_add_test(PREFIX "service_getPcontrolSelf" SOURCES getPcontrolSelf.c) 47 | 48 | easy_add_test(PREFIX "service_callHook" SOURCES callHook.c) 49 | 50 | if (HAVE_BUILTIN_RETURN_ADDRESS) 51 | easy_add_test(PREFIX "service_getReturnAddress" 52 | SOURCES getReturnAddress.c 53 | CONFIGS C_Init C_Send) 54 | if (ENABLE_FORTRAN) 55 | easy_add_test(PREFIX "service_getReturnAddress" 56 | SOURCES getReturnAddress.c 57 | CONFIGS Fortran_Init Fortran_Send) 58 | endif () 59 | endif () 60 | -------------------------------------------------------------------------------- /tests/pnmpi/service/getModuleSelf.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This test case checks, if the module is able to get its own module ID. The 32 | * module will be loaded multiple times to check that the module ID is different 33 | * for the different loaded modules. */ 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | 40 | 41 | void PNMPI_RegistrationPoint() 42 | { 43 | int handle; 44 | if (PNMPI_Service_GetModuleSelf(&handle) == PNMPI_SUCCESS) 45 | printf("My module ID: %d\n", handle); 46 | } 47 | 48 | 49 | /* MODTYPE: XMPI 50 | * 51 | * PNMPICONF: module @MODNAME@\n 52 | * PNMPICONF: module @MODNAME@\n 53 | * PNMPICONF: module @MODNAME@\n 54 | * 55 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 56 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 57 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 58 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 59 | * 60 | * PASS: 0.*1.*2 61 | */ 62 | -------------------------------------------------------------------------------- /tests/pnmpi/service/getPcontrolSelf.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This test case will check, if the module is able to query arguments. There 32 | * will be tests for querying the same and a different module for valid 33 | * arguments and querying an unknown argument in this test file. */ 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | 43 | void PNMPI_RegistrationPoint() 44 | { 45 | /* Only the first module in the stack should execute this test. Other handles 46 | * will be used to store arguments only. */ 47 | int self; 48 | if (PNMPI_Service_GetModuleSelf(&self) != PNMPI_SUCCESS) 49 | PNMPI_Error("Can't get module ID.\n"); 50 | if (self != 1) 51 | return; 52 | 53 | printf("GetPcontrolSelf: %d\n", PNMPI_Service_GetPcontrolSelf()); 54 | } 55 | 56 | 57 | /* MODTYPE: XMPI 58 | * 59 | * PNMPICONF: module @MODNAME@\n 60 | * PNMPICONF: pcontrol off\n 61 | * PNMPICONF: module @MODNAME@\n 62 | * PNMPICONF: pcontrol on\n 63 | * 64 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 65 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 66 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 67 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 68 | * 69 | * 70 | * PASS: GetPcontrolSelf: 1 71 | */ 72 | -------------------------------------------------------------------------------- /tests/pnmpi/service/getStackByName.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This test case checks, if stacks can be found by name. There will be tests 32 | * for a valid and an invalid name in this test file. */ 33 | 34 | #include 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | 42 | #ifndef TEST_STACKNAME 43 | #define TEST_STACKNAME "sample" 44 | #endif 45 | 46 | 47 | void PNMPI_RegistrationPoint() 48 | { 49 | /* Search for the module and print the return code or the matching module. */ 50 | PNMPI_modHandle_t stack; 51 | int ret = PNMPI_Service_GetStackByName(TEST_STACKNAME, &stack); 52 | switch (ret) 53 | { 54 | case PNMPI_SUCCESS: printf("GetStackByName: %d\n", stack); break; 55 | case PNMPI_NOSTACK: 56 | PNMPI_Warning("GetStackByName: %s\n", PNMPI_Service_strerror(ret)); 57 | break; 58 | 59 | default: PNMPI_Error("Unknown error: %d\n", ret); break; 60 | } 61 | } 62 | 63 | 64 | /* CONFIGS: found not_found 65 | * 66 | * MODTYPE: XMPI 67 | * 68 | * PNMPICONF: module @MODNAME@\n 69 | * PNMPICONF: stack sample\n 70 | * 71 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 72 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 73 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 74 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 75 | * 76 | * 77 | * PASS-found: GetStackByName: [0-9]+ 78 | * 79 | * COMPILE_FLAGS-not_found: -DTEST_STACKNAME=\"foo\" 80 | * PASS-not_found: GetStackByName: Stack not found 81 | */ 82 | -------------------------------------------------------------------------------- /tests/pnmpi/service/registerGlobal.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This test case checks, if a module is able to register a global. */ 32 | 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | 41 | int global_int = 42; 42 | 43 | 44 | void PNMPI_RegistrationPoint() 45 | { 46 | /* First test case for a global with invalid signature. */ 47 | PNMPI_Global_descriptor_t global; 48 | global.addr.i = &global_int; 49 | strncpy(global.name, "test", PNMPI_SERVICE_NAMELEN); 50 | global.sig = 'd'; 51 | 52 | /* First test case for a global with valid data. */ 53 | int ret = PNMPI_Service_RegisterGlobal(&global); 54 | if (ret != PNMPI_SUCCESS) 55 | PNMPI_Error("Error: %d\n", ret); 56 | printf("Registered global '%s'\n", global.name); 57 | } 58 | 59 | 60 | /* MODTYPE: XMPI 61 | * 62 | * PNMPICONF: module @MODNAME@ 63 | * 64 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 65 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 66 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 67 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 68 | * 69 | * PASS: Registered global 70 | */ 71 | -------------------------------------------------------------------------------- /tests/pnmpi/service/registerModule.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This test case checks, if a module is able to register itself. */ 32 | 33 | #include 34 | #include 35 | 36 | 37 | void PNMPI_RegistrationPoint() 38 | { 39 | PNMPI_Service_RegisterModule("registerTest"); 40 | } 41 | 42 | 43 | /* MODTYPE: XMPI 44 | * 45 | * PNMPICONF: module @MODNAME@ 46 | * 47 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 48 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 49 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 50 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 51 | * 52 | * PASS: registerTest 53 | */ 54 | -------------------------------------------------------------------------------- /tests/pnmpi/service/registerService.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This test case checks, if a module is able to register a service. */ 32 | 33 | #include 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | 41 | int foo() 42 | { 43 | return 0; 44 | } 45 | 46 | 47 | void PNMPI_RegistrationPoint() 48 | { 49 | PNMPI_Service_descriptor_t service; 50 | service.fct = &foo; 51 | strncpy(service.name, "test", PNMPI_SERVICE_NAMELEN); 52 | strncpy(service.sig, "", PNMPI_SERVICE_SIGLEN); 53 | 54 | int ret = PNMPI_Service_RegisterService(&service); 55 | if (ret != PNMPI_SUCCESS) 56 | PNMPI_Error("Error: %d\n", ret); 57 | printf("Registered service '%s'\n", service.name); 58 | } 59 | 60 | 61 | /* MODTYPE: XMPI 62 | * 63 | * PNMPICONF: module @MODNAME@ 64 | * 65 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 66 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 67 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 68 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 69 | * 70 | * PASS: Registered service 71 | */ 72 | -------------------------------------------------------------------------------- /tests/pnmpi/stacks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | easy_add_test(PREFIX stack SOURCES stack.c) 31 | -------------------------------------------------------------------------------- /tests/pnmpi/stacks/stack.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This is a simple test case to check the stack switching functionality. It 32 | * will be called in the default stack and tries to switch to a different stack. 33 | */ 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | 43 | int MPI_Init(int *argc, char ***argv) 44 | { 45 | static int flag = 0; 46 | 47 | PNMPI_modHandle_t stack; 48 | if (flag == 0 && 49 | PNMPI_Service_GetStackByName("sample", &stack) == PNMPI_SUCCESS) 50 | { 51 | printf("Switching the stack.\n"); 52 | flag = 1; 53 | XMPI_Init_NewStack(stack, argc, argv); 54 | } 55 | else 56 | XMPI_Init(argc, argv); 57 | 58 | return MPI_SUCCESS; 59 | } 60 | 61 | 62 | /* MODTYPE: XMPI 63 | * COMPILE_INCLUDES: @MPI_C_INCLUDE_PATH@ @PROJECT_SOURCE_DIR@/src/pnmpi 64 | * COMPILE_INCLUDES: @PROJECT_BINARY_DIR@ @PROJECT_BINARY_DIR@/src/pnmpi 65 | * COMPILE_FLAGS: @MPI_C_COMPILE_FLAGS@ 66 | * 67 | * PNMPICONF: module @MODNAME@\n 68 | * PNMPICONF: stack sample\n 69 | * PNMPICONF: module @MODNAME@ 70 | * 71 | * ENVIRONMENT: PNMPI_LIB_PATH=@CMAKE_CURRENT_BINARY_DIR@ 72 | * ENVIRONMENT: PNMPI_CONF=@PNMPICONF@ 73 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 74 | * RUN: @MPIEXEC_PREFLAGS@ @TESTBIN_MPI_C@ @MPIEXEC_POSTFLAGS@ 75 | * PASS: Switching the stack. 76 | */ 77 | -------------------------------------------------------------------------------- /tests/pnmpize/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | # If the PnMPIze tool will not be built, the following test cases can't be 31 | # executed. 32 | if (NOT ENABLE_PNMPIZE) 33 | return() 34 | endif () 35 | 36 | 37 | # Custom post-test hook for the PnMPIze tests. 38 | # 39 | macro(pnmpi_post_test TARGET CONFIG MAIN_SOURCE) 40 | # Set the library path, so PnMPIze can find PnMPI even if it's not yet 41 | # installed. 42 | if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 43 | set_property(TEST ${TARGET} APPEND PROPERTY ENVIRONMENT 44 | "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/src/pnmpi:$ENV{LD_LIBRARY_PATH}") 45 | else () 46 | # As mac OS security features may delete the DYLD_LIBRARY_PATH and 47 | # LD_LIBRARY_PATH variables under some circumstances, the alternate 48 | # PNMPI_LIBRARY_PATH variable will be used in this case. 49 | set_property(TEST ${TARGET} APPEND PROPERTY ENVIRONMENT 50 | "PNMPI_PATH=${PROJECT_BINARY_DIR}/src/pnmpi") 51 | endif () 52 | endmacro() 53 | 54 | 55 | # Set an PNMPIZE variable for all test cases, so they may use it for calling 56 | # PnMPIze. If AddressSanitizer is enabled, an extra wrapper will be used, so 57 | # AddressSanitizer will be initialized. 58 | set(PNMPIZE "$") 59 | if (SANITIZE_ADDRESS) 60 | set(PNMPIZE "${ASan_WRAPPER} ${PNMPIZE}") 61 | endif () 62 | 63 | 64 | easy_add_test(PREFIX pnmpize_exec SOURCES exec.conf NOBINARY) 65 | if (ENABLE_FORTRAN) 66 | easy_add_test(PREFIX pnmpize_exec_fortran SOURCES exec-fortran.conf NOBINARY) 67 | endif () 68 | 69 | easy_add_test(PREFIX pnmpize_config SOURCES config.c) 70 | easy_add_test(PREFIX pnmpize_debug SOURCES debug.conf NOBINARY) 71 | -------------------------------------------------------------------------------- /tests/pnmpize/config.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* The following test checks, if PnMPIze is able to pass a configuration file to 32 | * PnMPI. */ 33 | 34 | #include 35 | 36 | #include 37 | 38 | 39 | void PNMPI_RegistrationPoint() 40 | { 41 | printf("Sample module loaded.\n"); 42 | } 43 | 44 | 45 | /* MODTYPE: XMPI 46 | * 47 | * PNMPICONF: module @MODNAME@ 48 | * 49 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 50 | * RUN: @MPIEXEC_PREFLAGS@ @PNMPIZE@ @MPIEXEC_POSTFLAGS@ 51 | * RUN: -m @CMAKE_CURRENT_BINARY_DIR@ -c @PNMPICONF@ @TESTBIN_MPI_C@ 52 | * PASS: Sample module loaded. 53 | */ 54 | -------------------------------------------------------------------------------- /tests/pnmpize/exec-fortran.conf: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | # The following test checks, if PnMPIze starts PnMPI. If PnMPI header is not 31 | # found in stdout, the test will fail. 32 | RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 33 | RUN: @MPIEXEC_PREFLAGS@ @PNMPIZE@ @MPIEXEC_POSTFLAGS@ 34 | RUN: @TESTBIN_MPI_FORTRAN@ 35 | PASS: No modules loaded. 36 | -------------------------------------------------------------------------------- /tests/pnmpize/exec.conf: -------------------------------------------------------------------------------- 1 | # This file is part of P^nMPI. 2 | # 3 | # Copyright (c) 4 | # 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | # 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | # 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | # 8 | # 9 | # P^nMPI is free software; you can redistribute it and/or modify it under the 10 | # terms of the GNU Lesser General Public License as published by the Free 11 | # Software Foundation version 2.1 dated February 1999. 12 | # 13 | # P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | # details. 17 | # 18 | # You should have received a copy of the GNU Lesser General Public License 19 | # along with P^nMPI; if not, write to the 20 | # 21 | # Free Software Foundation, Inc. 22 | # 51 Franklin St, Fifth Floor 23 | # Boston, MA 02110, USA 24 | # 25 | # 26 | # Written by Martin Schulz, schulzm@llnl.gov. 27 | # 28 | # LLNL-CODE-402774 29 | 30 | CONFIGS: mpiexec preload 31 | 32 | # The following test should not check the whole functionality of PnMPIze, but 33 | # should check, if PnMPIze is able to execute a application after PnMPIze was 34 | # invoked via mpiexec. 35 | RUN-mpiexec: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 36 | RUN-mpiexec: @MPIEXEC_PREFLAGS@ @PNMPIZE@ @MPIEXEC_POSTFLAGS@ 37 | RUN-mpiexec: @TESTBIN_NOMPI@ 38 | PASS-mpiexec: Hello World! 39 | 40 | # The following test checks, if PnMPIze starts PnMPI. If PnMPI header is not 41 | # found in stdout, the test will fail. 42 | RUN-preload: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 43 | RUN-preload: @MPIEXEC_PREFLAGS@ @PNMPIZE@ @MPIEXEC_POSTFLAGS@ 44 | RUN-preload: @TESTBIN_MPI_C@ 45 | PASS-preload: No modules loaded. 46 | -------------------------------------------------------------------------------- /tests/src/mpi_errors.h.w: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | /* This file provides macros for MPI_* calls to check the calls for their 32 | * correct return value. If a call wrapped by this file failes, an error message 33 | * will be printed and the function exited. */ 34 | 35 | #ifndef PNMPI_MPI_ERRORS_H 36 | #define PNMPI_MPI_ERRORS_H 37 | 38 | 39 | #include // fprintf 40 | #include // EXIT_* macros 41 | 42 | #include 43 | 44 | 45 | {{forallfn fn_name}} 46 | #define {{fn_name}}({{args}}) \ 47 | { \ 48 | int err; \ 49 | if ((err = {{fn_name}}({{args}})) != MPI_SUCCESS) \ 50 | { \ 51 | fprintf(stderr, "%s:%d: {{fn_name}} returned an error: %i\n", \ 52 | __FILE__, __LINE__, err); \ 53 | exit(EXIT_FAILURE); \ 54 | } \ 55 | } 56 | {{endforallfn}} 57 | 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /tests/src/test-mpi-threaded.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include // fprintf, printf 32 | #include // EXIT_* macros 33 | 34 | #include "mpi_errors.h" 35 | 36 | 37 | int main(int argc, char **argv) 38 | { 39 | /* Initialize and finalize MPI. This should be enough to call all PnMPI setup 40 | * routines for threading support except the wrapper functions. 41 | * 42 | * The highest possible MPI threading level will be requested, so a possible 43 | * limiting of the threading level by PnMPI may be checked. */ 44 | int provided; 45 | MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); 46 | MPI_Finalize(); 47 | 48 | printf("Required: %d Provided: %d\n", MPI_THREAD_MULTIPLE, provided); 49 | 50 | /* In standard C the following return is not required, but in some situations 51 | * older versions of mpiexec report the job aborted, so the test case will 52 | * fail, even if it succeed. Returning EXIT_SUCCESS avoids this false error 53 | * message. */ 54 | return EXIT_SUCCESS; 55 | } 56 | 57 | 58 | /* DEPENDS: testbin-mpi-wrapper 59 | * COMPILE_INCLUDES: @CMAKE_CURRENT_BINARY_DIR@ @MPI_C_INCLUDE_PATH@ 60 | * COMPILE_FLAGS: @MPI_C_COMPILE_FLAGS@ 61 | * LINK: pnmpi @MPI_C_LIBRARIES@ 62 | * LINK_FLAGS: @MPI_C_LINK_FLAGS@ 63 | * 64 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 65 | * RUN: @MPIEXEC_PREFLAGS@ @BINARY@ @MPIEXEC_POSTFLAGS@ 66 | * PASS: Required: [0-9]+ Provided: [0-9]+ 67 | */ 68 | -------------------------------------------------------------------------------- /tests/src/test-mpi-threaded.f: -------------------------------------------------------------------------------- 1 | C This file is part of P^nMPI. 2 | C 3 | C Copyright (c) 4 | C 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | C 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | C 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | C 8 | C 9 | C P^nMPI is free software; you can redistribute it and/or modify it under the 10 | C terms of the GNU Lesser General Public License as published by the Free 11 | C Software Foundation version 2.1 dated February 1999. 12 | C 13 | C P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | C WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | C A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | C details. 17 | C 18 | C You should have received a copy of the GNU Lesser General Public License 19 | C along with P^nMPI; if not, write to the 20 | C 21 | C Free Software Foundation, Inc. 22 | C 51 Franklin St, Fifth Floor 23 | C Boston, MA 02110, USA 24 | C 25 | C 26 | C Written by Martin Schulz, schulzm@llnl.gov. 27 | C 28 | C LLNL-CODE-402774 29 | 30 | program firstmpi 31 | 32 | include 'mpif.h' 33 | 34 | integer :: ierror, required, provided 35 | required = MPI_THREAD_MULTIPLE 36 | call MPI_INIT_THREAD(required, provided, ierror) 37 | 38 | print *, "Required: ", required, " Provided: ", provided 39 | 40 | call MPI_FINALIZE(ierror) 41 | 42 | end program firstmpi 43 | 44 | 45 | C COMPILE_INCLUDES: @MPI_Fortran_INCLUDE_PATH@ 46 | C COMPILE_FLAGS: @MPI_Fortran_COMPILE_FLAGS@ 47 | C LINK: pnmpif @MPI_Fortran_LIBRARIES@ 48 | C LINK_FLAGS: @MPI_Fortran_LINK_FLAGS@ 49 | C 50 | C RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 51 | C RUN: @MPIEXEC_PREFLAGS@ @BINARY@ @MPIEXEC_POSTFLAGS@ 52 | C PASS: Required:.*[0-9]+.*Provided:.*[0-9]+ 53 | -------------------------------------------------------------------------------- /tests/src/test-mpi.f: -------------------------------------------------------------------------------- 1 | C This file is part of P^nMPI. 2 | C 3 | C Copyright (c) 4 | C 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | C 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | C 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | C 8 | C 9 | C P^nMPI is free software; you can redistribute it and/or modify it under the 10 | C terms of the GNU Lesser General Public License as published by the Free 11 | C Software Foundation version 2.1 dated February 1999. 12 | C 13 | C P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | C WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | C A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | C details. 17 | C 18 | C You should have received a copy of the GNU Lesser General Public License 19 | C along with P^nMPI; if not, write to the 20 | C 21 | C Free Software Foundation, Inc. 22 | C 51 Franklin St, Fifth Floor 23 | C Boston, MA 02110, USA 24 | C 25 | C 26 | C Written by Martin Schulz, schulzm@llnl.gov. 27 | C 28 | C LLNL-CODE-402774 29 | 30 | program firstmpi 31 | 32 | include 'mpif.h' 33 | 34 | integer :: ierror 35 | call MPI_INIT(ierror) 36 | call MPI_FINALIZE(ierror) 37 | 38 | end program firstmpi 39 | 40 | 41 | C Note: There is no special test for preloading PnMPI by environment variables, 42 | C as different MPI implementations handle environment variables in 43 | C different ways and the setting the variables for the whole test 44 | C environment interferes with additional tools like AddressSanitizer, as 45 | C it would be preloaded for mpiexec, too. However, preloading is 46 | C indirectly tested by the PnMPIze tests. 47 | C 48 | C 49 | C CONFIGS: dynamic static 50 | C 51 | C COMPILE_INCLUDES: @MPI_Fortran_INCLUDE_PATH@ 52 | C COMPILE_FLAGS: @MPI_Fortran_COMPILE_FLAGS@ 53 | C LINK_FLAGS: @MPI_Fortran_LINK_FLAGS@ 54 | C LINK: @MPI_Fortran_LIBRARIES@ 55 | C 56 | C RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 57 | C RUN: @MPIEXEC_PREFLAGS@ @BINARY@ @MPIEXEC_POSTFLAGS@ 58 | C PASS: No modules loaded. 59 | C 60 | C 61 | C LINK-dynamic: pnmpif @MPI_Fortran_LIBRARIES@ 62 | C 63 | C LINK-static: pnmpif_static @MPI_Fortran_LIBRARIES@ dl m 64 | -------------------------------------------------------------------------------- /tests/src/test-nompi.c: -------------------------------------------------------------------------------- 1 | /* This file is part of P^nMPI. 2 | * 3 | * Copyright (c) 4 | * 2008-2019 Lawrence Livermore National Laboratories, United States of America 5 | * 2011-2016 ZIH, Technische Universitaet Dresden, Federal Republic of Germany 6 | * 2013-2019 RWTH Aachen University, Federal Republic of Germany 7 | * 8 | * 9 | * P^nMPI is free software; you can redistribute it and/or modify it under the 10 | * terms of the GNU Lesser General Public License as published by the Free 11 | * Software Foundation version 2.1 dated February 1999. 12 | * 13 | * P^nMPI is distributed in the hope that it will be useful, but WITHOUT ANY 14 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 15 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16 | * details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with P^nMPI; if not, write to the 20 | * 21 | * Free Software Foundation, Inc. 22 | * 51 Franklin St, Fifth Floor 23 | * Boston, MA 02110, USA 24 | * 25 | * 26 | * Written by Martin Schulz, schulzm@llnl.gov. 27 | * 28 | * LLNL-CODE-402774 29 | */ 30 | 31 | #include // printf 32 | #include // EXIT_* macros 33 | 34 | 35 | int main(int argc, char **argv) 36 | { 37 | printf("Hello World!\n"); 38 | 39 | /* In standard C the following return is not required, but in some situations 40 | * older versions of mpiexec report the job aborted, so the test case will 41 | * fail, even if it succeed. Returning EXIT_SUCCESS avoids this false error 42 | * message. */ 43 | return EXIT_SUCCESS; 44 | } 45 | 46 | 47 | /* lsan_enabled: true 48 | * 49 | * RUN: @MPIEXEC@ @MPIEXEC_NUMPROC_FLAG@ 1 50 | * RUN: @MPIEXEC_PREFLAGS@ @BINARY@ @MPIEXEC_POSTFLAGS@ 51 | * Pass: Hello World! 52 | */ 53 | --------------------------------------------------------------------------------