diff --git a/overlay.nix b/overlay.nix index 2963918..400da74 100644 --- a/overlay.nix +++ b/overlay.nix @@ -12,11 +12,10 @@ let bscPkgs = { bench6 = callPackage ./pkgs/bench6/default.nix { }; clangOmpss2 = callPackage ./pkgs/llvm-ompss2/default.nix { }; + openmp = callPackage ./pkgs/llvm-ompss2/openmp.nix { monorepoSrc = final.clangOmpss2Unwrapped.src; version = final.clangOmpss2Unwrapped.version; }; clangOmpss2Nanos6 = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nanos6; }; clangOmpss2Nodes = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nodes; }; - clangOmpss2OpenmpNodes = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nodes; clangOmpss2Unwrapped = final.clangOmpss2OpenmpUnwrapped; }; clangOmpss2Unwrapped = callPackage ./pkgs/llvm-ompss2/clang.nix { }; - clangOmpss2OpenmpUnwrapped = final.clangOmpss2Unwrapped.override { enableNosv = true; }; #extrae = callPackage ./pkgs/extrae/default.nix { }; # Broken and outdated gpi-2 = callPackage ./pkgs/gpi-2/default.nix { }; intelPackages_2023 = callPackage ./pkgs/intel-oneapi/2023.nix { }; @@ -41,7 +40,6 @@ let stdenvClangOmpss2 = final.stdenv.override { cc = final.clangOmpss2; allowedRequisites = null; }; stdenvClangOmpss2Nanos6 = final.stdenv.override { cc = final.clangOmpss2Nanos6; allowedRequisites = null; }; stdenvClangOmpss2Nodes = final.stdenv.override { cc = final.clangOmpss2Nodes; allowedRequisites = null; }; - stdenvClangOmpss2OpenmpNodes = final.stdenv.override { cc = final.clangOmpss2OpenmpNodes; allowedRequisites = null; }; tagaspi = callPackage ./pkgs/tagaspi/default.nix { }; tampi = callPackage ./pkgs/tampi/default.nix { }; wxparaver = callPackage ./pkgs/paraver/default.nix { }; @@ -76,10 +74,10 @@ in bscPkgs // { stdenv = final.stdenvClangOmpss2Nodes; }; clangNosvOpenmp-task = callPackage ./test/compilers/clang-openmp.nix { - stdenv = final.stdenvClangOmpss2OpenmpNodes; + stdenv = final.stdenvClangOmpss2Nodes; }; clangNosvOpenmp-nosv = callPackage ./test/compilers/clang-openmp-nosv.nix { - stdenv = final.stdenvClangOmpss2OpenmpNodes; + stdenv = final.stdenvClangOmpss2Nodes; }; }; diff --git a/pkgs/llvm-ompss2/clang.nix b/pkgs/llvm-ompss2/clang.nix index 1d936fe..49dfecc 100644 --- a/pkgs/llvm-ompss2/clang.nix +++ b/pkgs/llvm-ompss2/clang.nix @@ -10,11 +10,9 @@ , elfutils , libffi , zlib -, nosv , pkg-config , gcc # needed to set the rpath of libstdc++ for clang-tblgen , enableDebug ? false -, enableNosv ? false , useGit ? false , gitUrl ? "ssh://git@bscpm03.bsc.es/llvm-ompss/llvm-mono.git" , gitBranch ? "master" @@ -73,8 +71,6 @@ in stdenv.mkDerivation rec { pkg-config zlib gcc.cc.lib # Required for libstdc++.so.6 - ] ++ lib.optionals enableNosv [ - nosv ]; # Error with -D_FORTIFY_SOURCE=2, see https://bugs.gentoo.org/636604: @@ -107,15 +103,12 @@ in stdenv.mkDerivation rec { "-DCMAKE_CXX_FLAGS_DEBUG=-g -ggnu-pubnames" "-DCMAKE_EXE_LINKER_FLAGS_DEBUG=-Wl,--gdb-index" "-DLLVM_LIT_ARGS=-sv --xunit-xml-output=xunit.xml" - "-DLLVM_ENABLE_PROJECTS=clang;openmp;compiler-rt;lld" + "-DLLVM_ENABLE_PROJECTS=clang;compiler-rt;lld" "-DLLVM_ENABLE_ASSERTIONS=ON" "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON" "-DCMAKE_INSTALL_BINDIR=bin" "-DLLVM_ENABLE_ZLIB=FORCE_ON" "-DLLVM_ENABLE_LIBXML2=OFF" - '' + (lib.optionalString enableNosv '' - "-DCLANG_DEFAULT_NOSV_HOME=${nosv}" - '') + '' # Set the rpath to include external libraries (zlib) both on build and # install "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON" @@ -124,12 +117,6 @@ in stdenv.mkDerivation rec { ''; - # Remove support for GNU and Intel Openmp - postInstall = '' - rm -f $out/lib/libgomp* - rm -f $out/lib/libiomp* - ''; - # About "-DCLANG_DEFAULT_NANOS6_HOME=${nanos6}", we could specify a default # nanos6 installation, but this is would require a recompilation of clang each # time nanos6 is changed. Better to use the environment variable NANOS6_HOME, diff --git a/pkgs/llvm-ompss2/openmp.nix b/pkgs/llvm-ompss2/openmp.nix new file mode 100644 index 0000000..5f79822 --- /dev/null +++ b/pkgs/llvm-ompss2/openmp.nix @@ -0,0 +1,57 @@ +{ lib +, llvmPackages_latest +, monorepoSrc +, runCommand +, cmake +, ninja +, llvm +, perl +, pkg-config +, version +, nosv +, enableDebug ? false +}: + +let + stdenv = llvmPackages_latest.stdenv; +in +stdenv.mkDerivation rec { + pname = "openmp"; + inherit version; + + src = runCommand "${pname}-src" {} '' + mkdir -p "$out" + cp -r ${monorepoSrc}/cmake "$out" + cp -r ${monorepoSrc}/${pname} "$out" + ''; + + sourceRoot = "${src.name}/${pname}"; + + nativeBuildInputs = [ + cmake + ninja + perl + pkg-config + nosv + ]; + + doCheck = false; + + hardeningDisable = [ "all" ]; + + cmakeBuildType = if enableDebug then "Debug" else "Release"; + + dontStrip = enableDebug; + + cmakeFlags = [ + "-DLIBOMP_OMPD_SUPPORT=OFF" + "-DOPENMP_ENABLE_LIBOMPTARGET=OFF" + ]; + + # Remove support for GNU and Intel Openmp + postInstall = '' + rm -f $out/lib/libgomp* + rm -f $out/lib/libiomp* + ''; +} + diff --git a/test/compilers/clang-openmp-nosv.nix b/test/compilers/clang-openmp-nosv.nix index 237e466..d11f2e1 100644 --- a/test/compilers/clang-openmp-nosv.nix +++ b/test/compilers/clang-openmp-nosv.nix @@ -2,6 +2,7 @@ stdenv , nosv , writeText +, openmp }: let @@ -40,7 +41,7 @@ in stdenv.mkDerivation { # fail to run otherwise, so we disable the sandbox for this test. __noChroot = true; - buildInputs = [ nosv ]; + buildInputs = [ nosv openmp ]; buildPhase = '' set -x diff --git a/test/compilers/clang-openmp.nix b/test/compilers/clang-openmp.nix index 42044c7..7f3e0d8 100644 --- a/test/compilers/clang-openmp.nix +++ b/test/compilers/clang-openmp.nix @@ -1,6 +1,7 @@ { stdenv , writeText +, openmp }: let @@ -28,6 +29,8 @@ in stdenv.mkDerivation { # fail to run otherwise, so we disable the sandbox for this test. __noChroot = true; + buildInputs = [ openmp ]; + buildPhase = '' set -x