Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
-DSCOREC_CXX_WARNINGS=ON
-DIS_TESTING=ON
-DMESHES=${{github.workspace}}/pumi-meshes
-DSCOREC_NO_MPI=${{matrix.no_mpi}}
-DPUMI_NO_MPI=${{matrix.no_mpi}}
-DENABLE_METIS=${{matrix.metis}}

- name: Build
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
cmake --build ${{github.workspace}}/buildExample

- name: Build MPI-NoMPI Example
# Test if a SCOREC_NO_MPI build works with MPI applications.
# Test if a PUMI_NO_MPI build works with MPI applications.
if: >-
matrix.compiler.name == 'GNU' && matrix.build_type == 'Release' &&
matrix.no_mpi == 'ON'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doxygen-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
env:
MPICH_CXX: g++-10
MPICH_CC: gcc-10
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_C_COMPILER=mpicc -DCMAKE_VERBOSE_MAKEFILE=ON -DMESHES=${{github.workspace}}/pumi-meshes -DIS_TESTING=ON -DSCOREC_CXX_WARNINGS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install -DSCOREC_NO_MPI=ON
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_C_COMPILER=mpicc -DCMAKE_VERBOSE_MAKEFILE=ON -DMESHES=${{github.workspace}}/pumi-meshes -DIS_TESTING=ON -DSCOREC_CXX_WARNINGS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install -DPUMI_NO_MPI=ON

- name: Generate Doc
run: doxygen ${{github.workspace}}/build/Doxyfile
Expand Down
79 changes: 44 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,31 @@ if(USE_XSDK_DEFAULTS)
xsdk_compiler_flags()
endif()

option(ENABLE_CGNS "Enable the CGNS reader: requires c++14 extensions" OFF)
message(STATUS "ENABLE_CGNS: ${ENABLE_CGNS}")
option(ENABLE_OMEGA_H "Enable the Omega_h interface" OFF)
option(PUMI_ENABLE_CGNS
"Enable the CGNS reader (requires c++14 extensions)" ${ENABLE_CGNS}
)
message(STATUS "PUMI_ENABLE_CGNS: ${PUMI_ENABLE_CGNS}")
option(PUMI_ENABLE_OMEGA_H "Enable the Omega_h interface" ${ENABLE_OMEGA_H})
set(PUMI_USE_OMEGA_H_VERSION "10.0.0" CACHE STRING "Specify the Omega_h version PUMI should use")
message(STATUS "ENABLE_OMEGA_H: ${ENABLE_OMEGA_H}")
if(NOT ENABLE_CGNS AND NOT ENABLE_OMEGA_H)
message(STATUS "PUMI_ENABLE_OMEGA_H: ${PUMI_ENABLE_OMEGA_H}")
if(NOT PUMI_ENABLE_CGNS AND NOT PUMI_ENABLE_OMEGA_H)
message(STATUS "enabling cxx11")
bob_set_cxx_standard(11)
elseif(ENABLE_CGNS)
elseif(PUMI_ENABLE_CGNS)
message(STATUS "enabling cxx14")
bob_set_cxx_standard(14)
elseif(ENABLE_OMEGA_H)
elseif(PUMI_ENABLE_OMEGA_H)
message(STATUS "enabling cxx17")
bob_set_cxx_standard(17)
endif()

#
# option related to MPI
#
option(SCOREC_NO_MPI "Disable MPI support. When enabled only serial execution is supported." OFF)
message(STATUS "SCOREC_NO_MPI: ${SCOREC_NO_MPI}")
if(SCOREC_NO_MPI AND ENABLE_CGNS)
message(FATAL_ERROR "SCOREC_NO_MPI is incompatible with CGNS.")
option(PUMI_NO_MPI "Disable MPI support. When enabled only serial execution is supported." OFF)
message(STATUS "PUMI_NO_MPI: ${PUMI_NO_MPI}")
if(PUMI_NO_MPI AND PUMI_ENABLE_CGNS)
message(FATAL_ERROR "PUMI_NO_MPI is incompatible with CGNS.")
endif()

# Set some default compiler flags that should always be used
Expand All @@ -51,7 +53,7 @@ if(NOT USE_XSDK_DEFAULTS)
bob_begin_cxx_flags()
bob_end_cxx_flags()
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
if(ENABLE_CGNS)
if(PUMI_ENABLE_CGNS)
bob_cxx14_flags()
else()
bob_cxx11_flags()
Expand Down Expand Up @@ -103,26 +105,33 @@ add_custom_target(check
set(Trilinos_PREFIX "" CACHE STRING "Trilinos installation directory")

option(SKIP_SIMMETRIX_VERSION_CHECK "enable at your own risk; it may result in undefined behavior" OFF)
option(ENABLE_SIMMETRIX "Build with Simmetrix support" OFF)
message(STATUS "ENABLE_SIMMETRIX: ${ENABLE_SIMMETRIX}")
option(PUMI_ENABLE_CAPSTONE "Build PUMI with Capstone support" OFF)
# For compatibility and to inherit from owning projects:
if(ENABLE_CAPSTONE)
set(PUMI_ENABLE_CAPSTONE ON)
endif()
option(
PUMI_ENABLE_SIMMETRIX
"Build PUMI with Simmetrix support"
${ENABLE_SIMMETRIX} # For compatibility and to inherit from owning projects
)
message(STATUS "PUMI_ENABLE_SIMMETRIX: ${PUMI_ENABLE_SIMMETRIX}")
if(PUMI_ENABLE_SIMMETRIX)
add_definitions(-DPUMI_HAS_SIMMETRIX)
endif()
option(
PUMI_ENABLE_CAPSTONE
"Build PUMI with Capstone support"
${ENABLE_CAPSTONE}
)
message(STATUS "PUMI_ENABLE_CAPSTONE: ${PUMI_ENABLE_CAPSTONE}")

if(ENABLE_SIMMETRIX)
add_definitions(-DHAVE_SIMMETRIX)
endif()
if(PUMI_ENABLE_CAPSTONE)
add_definitions(-DPUMI_HAS_CAPSTONE)
endif()

option(ENABLE_FPP "Build with snapping to first problem plane" OFF)
message(STATUS "ENABLE_FPP: ${ENABLE_FPP}")
if(ENABLE_FPP)
add_definitions(-DDO_FPP)
option(
PUMI_ENABLE_FPP
"Build with snapping to first problem plane"
${ENABLE_FPP} # Inherit default value
)
message(STATUS "PUMI_ENABLE_FPP: ${PUMI_ENABLE_FPP}")
if(PUMI_ENABLE_FPP)
add_definitions(-DPUMI_DO_FPP)
endif()

macro(scorec_export_library target)
Expand All @@ -144,7 +153,7 @@ macro(scorec_export_library target)
endif()
endmacro(scorec_export_library)

if(ENABLE_SIMMETRIX)
if(PUMI_ENABLE_SIMMETRIX)
find_package(SimModSuite MODULE REQUIRED)
endif()

Expand All @@ -153,23 +162,23 @@ if(PUMI_ENABLE_CAPSTONE)
bob_public_dep(CreateMG)
endif()

if(ENABLE_OMEGA_H)
if(PUMI_ENABLE_OMEGA_H)
bob_cxx17_flags()
bob_set_cxx_standard(17)
# find the omega_h library
set(SCOREC_USE_Omega_h_DEFAULT ${ENABLE_OMEGA_H})
set(SCOREC_USE_Omega_h_DEFAULT ${PUMI_ENABLE_OMEGA_H})
set(Omega_h_REQUIRED_VERSION ${PUMI_USE_OMEGA_H_VERSION})
bob_public_dep(Omega_h)
endif()

if(ENABLE_CGNS)
set(SCOREC_USE_CGNS_DEFAULT ${ENABLE_CGNS})
if(PUMI_ENABLE_CGNS)
set(SCOREC_USE_CGNS_DEFAULT ${PUMI_ENABLE_CGNS})
bob_public_dep(CGNS)
#CGNS does not provide cmake targets :(
include_directories(SYSTEM ${CGNS_INCLUDE_DIR})
set(SCOREC_USE_HDF5_DEFAULT ${ENABLE_CGNS})
set(SCOREC_USE_HDF5_DEFAULT ${PUMI_ENABLE_CGNS})
bob_public_dep(HDF5)
add_definitions(-DHAVE_CGNS)
add_definitions(-DPUMI_HAS_CGNS)
endif()

configure_file(SCOREC_config.h.in SCOREC_config.h)
Expand Down Expand Up @@ -205,7 +214,7 @@ add_subdirectory(apf_cap)
# this INTERFACE target bundles all the enabled libraries together
add_library(core INTERFACE)
target_link_libraries(core INTERFACE ${SCOREC_EXPORTED_TARGETS})
if(ENABLE_CGNS)
if(PUMI_ENABLE_CGNS)
target_link_libraries(core INTERFACE ${CMAKE_DL_LIBS}) #HDF5 uses dlopen
endif()
scorec_export_library(core)
Expand Down
2 changes: 1 addition & 1 deletion SCOREC_config.h.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SCOREC_CONFIG_H
#define SCOREC_CONFIG_H

#cmakedefine SCOREC_NO_MPI
#cmakedefine PUMI_NO_MPI

#endif // SCOREC_CONFIG_H

6 changes: 4 additions & 2 deletions apf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ set(SOURCES
apfMIS.cc
)

if(ENABLE_CGNS)
if(PUMI_ENABLE_CGNS)
set(SOURCES ${SOURCES} apfCGNS.cc)
endif(ENABLE_CGNS)
else()
set(SOURCES ${SOURCES} apfCGNSempty.cc)
endif()

# Package headers
set(HEADERS
Expand Down
17 changes: 3 additions & 14 deletions apf/apfCGNS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@
#include <errno.h> /* for checking the error from mkdir */
// ===============================

#ifdef HAVE_CGNS
//
#include <cgns_io.h>
#include <pcgnslib.h>
//
#endif

// Note: currently, even in 2D or 1D a full 3D vector and matrix are written out to the file

Expand Down Expand Up @@ -705,7 +701,7 @@ void AddBocosToMainBase(const CGNS &cgns, const CellElementReturn &cellResults,
displacement[i] = displacement[i - 1] + sizes[i - 1];

allElements.resize(totalLength);
#ifndef SCOREC_NO_MPI
#ifndef PUMI_NO_MPI
PCU_Comm comm;
m->getPCU()->DupComm(&comm);
MPI_Allgatherv(bcList.data(), bcList.size(), MPI_INT, allElements.data(),
Expand Down Expand Up @@ -1138,7 +1134,7 @@ void WriteCGNS(const char *prefix, apf::Mesh *m, const apf::CGNSBCMap &cgnsBCMap
destroyGlobalNumbering(gcn);
//
cgp_close(cgns.index);
#ifndef SCOREC_NO_MPI
#ifndef PUMI_NO_MPI
MPI_Comm_free(&communicator);
#endif
}
Expand All @@ -1147,15 +1143,8 @@ void WriteCGNS(const char *prefix, apf::Mesh *m, const apf::CGNSBCMap &cgnsBCMap
namespace apf
{

void writeCGNS(const char *prefix, Mesh *m, const apf::CGNSBCMap &cgnsBCMap)
{
#ifdef HAVE_CGNS
void writeCGNS(const char *prefix, Mesh *m, const apf::CGNSBCMap &cgnsBCMap) {
WriteCGNS(prefix, m, cgnsBCMap);
#else
PCU_ALWAYS_ASSERT_VERBOSE(true == false,
"Build with ENABLE_CGNS to allow this functionality.");
exit(EXIT_FAILURE);
#endif
}

} // namespace apf
9 changes: 9 additions & 0 deletions apf/apfCGNSempty.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <apf.h>

namespace apf {

void writeCGNS(const char*, Mesh*, const apf::CGNSBCMap&) {
fail("Build with PUMI_ENABLE_CGNS to enable apf::writeCGNS.");
}

} // namespace apf
6 changes: 4 additions & 2 deletions apf/pkg_tribits.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ set(APF_SOURCES
apfFile.cc
)

if(ENABLE_CGNS)
if(PUMI_ENABLE_CGNS)
set(APF_SOURCES ${APF_SOURCES} apfCGNS.cc)
endif(ENABLE_CGNS)
else()
set(APF_SOURCES ${APF_SOURCES} apfCGNSempty.cc)
endif()

set(APF_HEADERS
apf.h
Expand Down
18 changes: 11 additions & 7 deletions apf_sim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if(DEFINED TRIBITS_PACKAGE)
return()
endif()

if(NOT ENABLE_SIMMETRIX)
if(NOT PUMI_ENABLE_SIMMETRIX)
return()
endif()

Expand All @@ -21,13 +21,17 @@ target_include_directories(apf_sim PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)

option(ENABLE_FIELDSIM "Enable use of FieldSim from Simmetrix SimModSuite" FALSE)
message(STATUS "ENABLE_FIELDSIM: ${ENABLE_FIELDSIM}")
set(USE_FIELDSIM FALSE)
if( ${SIMMODSUITE_SimField_FOUND} AND ENABLE_FIELDSIM )
set(USE_FIELDSIM TRUE)
option(
PUMI_ENABLE_FIELDSIM
"Request use of FieldSim from Simmetrix SimModSuite (only used if found)"
${ENABLE_FIELDSIM} # Inherit default value
)
message(STATUS "PUMI_ENABLE_FIELDSIM: ${PUMI_ENABLE_FIELDSIM}")
set(PUMI_USE_FIELDSIM FALSE)
if( ${SIMMODSUITE_SimField_FOUND} AND PUMI_ENABLE_FIELDSIM )
set(PUMI_USE_FIELDSIM TRUE)
endif()
set(USE_SIM_ADVMESHING ${HAVE_SIMADVMESHING})
set(PUMI_HAS_SIMADVMESHING ${SIMMODSUITE_SimAdvMeshing_FOUND})

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/apf_simConfig.h.in"
Expand Down
2 changes: 1 addition & 1 deletion apf_sim/apfSIM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <pcu_util.h>
#include <algorithm>

#ifdef USE_FIELDSIM
#ifdef PUMI_USE_FIELDSIM

#include "apfSIMDataOf.h"

Expand Down
4 changes: 2 additions & 2 deletions apf_sim/apf_simConfig.h.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#cmakedefine USE_FIELDSIM
#cmakedefine USE_SIM_ADVMESHING
#cmakedefine PUMI_USE_FIELDSIM
#cmakedefine PUMI_HAS_SIMADVMESHING
#cmakedefine SIMMODSUITE_MAJOR_VERSION @SIMMODSUITE_MAJOR_VERSION@
#cmakedefine SIMMODSUITE_MINOR_VERSION @SIMMODSUITE_MINOR_VERSION@
5 changes: 4 additions & 1 deletion cmake/bob.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ macro(bob_set_shared_libs)
message(STATUS "BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}")
endmacro(bob_set_shared_libs)

# Flags can be set either by bob's three flags or by CMAKE_BUILD_TYPE. The
# advantage of CMAKE_BUILD_TYPE is that you get modern defaults, but the
# USE_DEFAULT_XSDK flag always sets the CMAKE_BUILD_TYPE to "DEBUG".
function(bob_begin_cxx_flags)
option(${PROJECT_NAME}_CXX_OPTIMIZE "Compile C++ with optimization" ON)
option(${PROJECT_NAME}_CXX_SYMBOLS "Compile C++ with debug symbols" ON)
Expand Down Expand Up @@ -74,7 +77,7 @@ function(bob_begin_cxx_flags)
else()
message(WARNING "Unexpected compiler type ${CMAKE_CXX_COMPILER_ID}")
endif()
set(CMAKE_CXX_FLAGS "${FLAGS}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${FLAGS}" PARENT_SCOPE) # Upgrade to directory scope
endfunction(bob_begin_cxx_flags)

# The following is from the book,"Professional CMake: 19th edition"
Expand Down
8 changes: 2 additions & 6 deletions doc/myprogram.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#include <PCU.h>
#include "mylibrary.h"
int main(int argc, char** argv) {
#ifndef SCOREC_NO_MPI
MPI_Init(&argc,&argv);
#endif
pcu::Init(&argc, &argv);
pcu::PCU PCUObj;
makeMesh(&PCUObj);
#ifndef SCOREC_NO_MPI
MPI_Finalize();
#endif
pcu::Finalize();
return 0;
}
10 changes: 7 additions & 3 deletions dsp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Component options
option(ENABLE_DSP "Enable the dsp package [ON|OFF]" OFF)
message(STATUS "ENABLE_DSP: " ${ENABLE_DSP})
option(
PUMI_ENABLE_DSP
"Enable the dsp package [ON|OFF]"
${ENABLE_DSP} # compatability with PUMI < 5.0 and/or inherit from parent
)
message(STATUS "PUMI_ENABLE_DSP: " ${PUMI_ENABLE_DSP})

# Only install the package if enabled
if(NOT ENABLE_DSP)
if(NOT PUMI_ENABLE_DSP)
return()
endif()

Expand Down
6 changes: 3 additions & 3 deletions example/mpi-nompi/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Example: Using SCOREC_NO_MPI in an MPI application
# Example: Using PUMI_NO_MPI in an MPI application

This example demonstrates how to combine a SCOREC_NO_MPI build of core with an
application that is using MPI. This is the prime use case for the SCOREC_NO_MPI
This example demonstrates how to combine a PUMI_NO_MPI build of core with an
application that is using MPI. This is the prime use case for the PUMI_NO_MPI
option.

2 changes: 1 addition & 1 deletion example/mpi-nompi/test_coll.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main(int argc, char** argv) {
if (rank == 0)
std::cout << "MPI size: " << size << "; PCU size: " <<
PCUObj.Peers() << std::endl;
#ifdef SCOREC_NO_MPI
#ifdef PUMI_NO_MPI
PCU_ALWAYS_ASSERT(PCUObj.Self() == 0);
PCU_ALWAYS_ASSERT(PCUObj.Peers() == 1);
#else
Expand Down
2 changes: 1 addition & 1 deletion gmi_sim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if(DEFINED TRIBITS_PACKAGE)
return()
endif()

if(NOT ENABLE_SIMMETRIX)
if(NOT PUMI_ENABLE_SIMMETRIX)
return()
endif()

Expand Down
Loading