Fix OpenMP 12+ issue

pull/12/head
Ibrahim Numanagić 2022-02-25 18:25:29 -08:00
parent 1ec5cd2958
commit c8b757859a
3 changed files with 5 additions and 2 deletions

View File

@ -68,7 +68,7 @@ endif()
CPMAddPackage(
NAME openmp
GITHUB_REPOSITORY "exaloop/openmp"
VERSION 13.0.0-fb9fc3c
VERSION 12.0.1
OPTIONS "CMAKE_BUILD_TYPE Release"
"OPENMP_ENABLE_LIBOMPTARGET OFF"
"OPENMP_STANDALONE_BUILD ON")

View File

@ -7,7 +7,7 @@
#include "codon/util/semver/semver.h"
#include "codon/util/toml++/toml.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Filesystem.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
namespace codon {

View File

@ -54,6 +54,9 @@ SEQ_FUNC void seq_init(int flags) {
GC_INIT();
GC_set_warn_proc(GC_ignore_warn_proc);
GC_allow_register_threads();
// Disable libopenmp 12+'s hidden helper threads that
// cause segfaults with omp_critical in Codon
setenv("LIBOMP_NUM_HIDDEN_HELPER_THREADS", "0", true);
// equivalent to: #pragma omp parallel { register_thread }
__kmpc_fork_call(&dummy_loc, 0, (kmpc_micro)register_thread);
seq_exc_init();