Skip to content

Commit

Permalink
support serial build with simmodsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
cwsmith committed Nov 10, 2023
1 parent fabcd53 commit bddc30f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ if ((Omega_h_MEM_SPACE_DEVICE AND Omega_h_MEM_SPACE_HOSTPINNED) OR
endif()

bob_option(Omega_h_USE_MPI "Use MPI for parallelism" OFF)
if(Omega_h_USE_SimModSuite AND NOT Omega_h_USE_MPI)
message(FATAL_ERROR "Omega_h_USE_MPI must be enabled if Omega_h_USE_SimModSuite is enabled")
endif()
bob_option(Omega_h_USE_OpenMP "Whether to use OpenMP" "${Kokkos_HAS_OpenMP}")
bob_option(Omega_h_USE_CUDA "Whether to use CUDA" "${Kokkos_HAS_CUDA}")

Expand Down
55 changes: 37 additions & 18 deletions cmake/FindSimModSuite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,24 @@
# include/*.h
# lib/ARCHOS/*.a

set(SIM_MPI "" CACHE STRING "MPI implementation used for SimPartitionWrapper")
if(SIM_MPI MATCHES "^$")
message(FATAL_ERROR "SIM_MPI is not defined... libSimPartitionWrapper-$SIM_MPI.a should exist in the SimModSuite lib directory")
if (Omega_h_USE_MPI)
set(SIM_MPI "" CACHE STRING "MPI implementation used for SimPartitionWrapper")
if(SIM_MPI MATCHES "^$")
message(FATAL_ERROR "SIM_MPI is not defined... libSimPartitionWrapper-$SIM_MPI.a should exist in the SimModSuite lib directory")
endif()
endif()

macro(simLibCheckBootstrap libs)
simLibCheck(${libs} TRUE)
string(FIND "${SIMMODSUITE_LIBS}" "/lib/" archStart)
string(FIND "${SIMMODSUITE_LIBS}" "/libSim" archEnd)
math(EXPR archStart "${archStart}+5")
math(EXPR len "${archEnd}-${archStart}")
string(SUBSTRING "${SIMMODSUITE_LIBS}" "${archStart}" "${len}" SIM_ARCHOS)
message(STATUS "SIM_ARCHOS ${SIM_ARCHOS}")
set(SIMMODSUITE_LIBS "")
endmacro(simLibCheckBootstrap)

macro(simLibCheck libs isRequired)
foreach(lib ${libs})
unset(simlib CACHE)
Expand Down Expand Up @@ -98,17 +111,14 @@ message(STATUS "Building with SimModSuite ${SIM_DOT_VERSION}")

set(SIMMODSUITE_LIBS "")

set(SIM_BOOTSTRAP_LIB_NAME
SimPartitionedMesh-mpi)
if (Omega_h_USE_MPI)
set(SIM_BOOTSTRAP_LIB_NAME SimPartitionedMesh-mpi)
else()
set(SIM_BOOTSTRAP_LIB_NAME SimPartitionedMesh)
endif()

simLibCheck("${SIM_BOOTSTRAP_LIB_NAME}" TRUE)
simLibCheckBootstrap("${SIM_BOOTSTRAP_LIB_NAME}")

string(FIND "${SIMMODSUITE_LIBS}" "/lib/" archStart)
string(FIND "${SIMMODSUITE_LIBS}" "/libSim" archEnd)
math(EXPR archStart "${archStart}+5")
math(EXPR len "${archEnd}-${archStart}")
string(SUBSTRING "${SIMMODSUITE_LIBS}" "${archStart}" "${len}" SIM_ARCHOS)
message(STATUS "SIM_ARCHOS ${SIM_ARCHOS}")

option(SIM_PARASOLID "Use Parasolid through Simmetrix" OFF)
if (SIM_PARASOLID)
Expand Down Expand Up @@ -157,12 +167,21 @@ set(SIM_OPT_LIB_NAMES

simLibCheck("${SIM_OPT_LIB_NAMES}" FALSE)

set(SIM_CORE_LIB_NAMES
SimPartitionedMesh-mpi
SimMeshing
SimMeshTools
SimModel
SimPartitionWrapper-${SIM_MPI})
if (Omega_h_USE_MPI)
message(STATUS "cake mpi is enabled!")
set(SIM_CORE_LIB_NAMES
SimPartitionedMesh-mpi
SimMeshing
SimMeshTools
SimModel
SimPartitionWrapper-${SIM_MPI})
else()
message(STATUS "cake mpi is disabled!")
set(SIM_CORE_LIB_NAMES
SimMeshing
SimMeshTools
SimModel)
endif()

simLibCheck("${SIM_CORE_LIB_NAMES}" TRUE)

Expand Down
2 changes: 0 additions & 2 deletions src/Omega_h_meshsim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "Omega_h_mesh.hpp"
#include "Omega_h_adj.hpp"

#include "SimPartitionedMesh.h"
#include "SimModel.h"
#include "SimUtil.h"
#include "SimDiscrete.h"
Expand Down Expand Up @@ -639,7 +638,6 @@ void read_internal(pMesh m, Mesh* mesh, pMeshNex numbering) {

Mesh readImpl(filesystem::path const& mesh_fname, filesystem::path const& mdl_fname,
filesystem::path const& numbering_fname, CommPtr comm) {
SimPartitionedMesh_start(NULL,NULL);
SimModel_start();
Sim_readLicenseFile(NULL);
SimDiscrete_start(0);
Expand Down

0 comments on commit bddc30f

Please sign in to comment.