Skip to content

Commit

Permalink
Merge branch 'omp_toggle_and_rm_unusedcode' into 'develop'
Browse files Browse the repository at this point in the history
Remove now-unused threading support wrappers from draco; add an explicit toggle for OMP support

See merge request draco/draco!192
  • Loading branch information
Mathew Allen Cleveland committed Feb 8, 2023
2 parents 909883d + 939dfd1 commit bd0c69e
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 532 deletions.
27 changes: 25 additions & 2 deletions config/compilerEnv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,27 @@ macro(query_openmp_availability)
# set(OpenMP_FOUND TRUE)
# set(OpenMP_C_VERSION "3.1")
# ~~~
set(OpenMP_FOUND FALSE)
set(USE_OPENMP OFF)
elseif(DEFINED USE_OPENMP)
# no-op (use defined value, -DUSE_OPENMP=<OFF|ON>, instead of attempting to guess)
elseif(DEFINED ENV{USE_OPENMP})
# Use the value found in the environment: `export USE_OPENMP=<OFF|ON>`
set(USE_OPENMP $ENV{USE_OPENMP})
else()
# Assume we want to use it if it is found.
set(USE_OPENMP ON)
endif()
set(USE_OPENMP
${USE_OPENMP}
CACHE BOOL "Enable OpenMP threading support if detected." FORCE)

# Find package if desired:
if(USE_OPENMP)
find_package(OpenMP QUIET)
else()
set(OpenMP_FOUND FALSE)
endif()

if(OpenMP_FOUND)
# [2022-10-27 KT] cmake/3.22 doesn't report OpenMP_C_VERSION for nvc++. Fake it for now.
if("${OpenMP_C_VERSION}x" STREQUAL "x" AND CMAKE_CXX_COMPILER_ID MATCHES "NVHPC")
Expand All @@ -93,7 +110,13 @@ macro(query_openmp_availability)
${OpenMP_FOUND}
CACHE BOOL "Is OpenMP available?" FORCE)
else()
message(STATUS "Looking for OpenMP... not found")
if(USE_OPENMP)
# Not detected, though desired.
message(STATUS "Looking for OpenMP... not found")
else()
# Detected, but not desired.
message(STATUS "Looking for OpenMP... found, but disabled for this build")
endif()
endif()
endmacro()

Expand Down
9 changes: 7 additions & 2 deletions config/draco-config-install.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# author Kelly Thompson <[email protected]>
# date 2012 Aug 1
# brief Save Draco configuration information for installation (cmake export)
# note Copyright (C) 2012-2022 Triad National Security, LLC., All rights reserved.
# note Copyright (C) 2012-2023 Triad National Security, LLC., All rights reserved.
#--------------------------------------------------------------------------------------------------#
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}" )
get_filename_component( _SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH )
Expand Down Expand Up @@ -51,8 +51,13 @@ set(Draco_MPIEXEC_NUMPROC_FLAG "@MPIEXEC_NUMPROC_FLAG@")
set(Draco_MPI_C_WORKS "@MPI_C_WORKS@") # Used to help CAFS setup on Win32
set(Draco_MPI_LANG_LIST "@Draco_MPI_LANG_LIST@")

# GPU build information
#--------------------------------------------------------------------------------------------------#
# OpenMP toggle
# This allows us to explicitly disable OpenMP support (may be needed for mixed toolchains)
#--------------------------------------------------------------------------------------------------#
set(USE_OPENMP "@USE_OPENMP@")

# GPU build information
option(HAVE_GPU "Should we build GPU (HIP or CUDA) parts of the project?" @HAVE_GPU@)
set(USE_GPU "@USE_GPU@")
set(GPU_DBS_STRING "@GPU_DBS_STRING@")
Expand Down
2 changes: 1 addition & 1 deletion src/device/device_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#endif

#ifdef USE_HIP
#include <hip/hip_runtime_api.h>
#include <hip/hip_runtime.h>
#include <hip/hip_runtime_api.h>
#define cudaError_t hipError_t
#define cudaGetDevice hipGetDevice
#define cudaSetDevice hipSetDevice
Expand Down
68 changes: 0 additions & 68 deletions src/ds++/Thread_Wrapper.hh

This file was deleted.

74 changes: 0 additions & 74 deletions src/ds++/atomics.hh

This file was deleted.

9 changes: 1 addition & 8 deletions src/ds++/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# author Kelly Thompson <[email protected]>
# date 2010 April 28
# brief Instructions for building ds++/test level Makefile.
# note Copyright (C) 2010-2022 Triad National Security, LLC., All rights reserved.
# note Copyright (C) 2010-2023 Triad National Security, LLC., All rights reserved.
#--------------------------------------------------------------------------------------------------#
project(dsxx_test CXX)

Expand Down Expand Up @@ -35,13 +35,6 @@ list(REMOVE_ITEM test_sources ${PROJECT_SOURCE_DIR}/tstScalarUnitTest.cc)
# The remaining tests
add_scalar_tests(SOURCES "${test_sources}" DEPS Lib_dsxx)

# tstatomics will use 19 hw threads. Help ctest schedule this job by setting test properties. We
# don't need to reserve 19 cores, but let's reserve 10 (assume 2 hw threads per physical core.)
set_tests_properties(
dsxx_tstatomics
PROPERTIES
PROCESSORS 10)

# (2013-11-13 KT):: tstdbc intentionally divides by zero (to test the isinfinity function). PGI
# issues a warning for this case that we don't care about. Since PGI does not appear to use pragmas
# to suppress warnings, I am turning off warnings for Ut_dsxx_tstdbc_exe when the compiler is PGI.
Expand Down
129 changes: 0 additions & 129 deletions src/ds++/test/tstThread_Wrapper.cc

This file was deleted.

Loading

0 comments on commit bd0c69e

Please sign in to comment.