diff --git a/overlay.nix b/overlay.nix index 9ad35364..450ae9eb 100644 --- a/overlay.nix +++ b/overlay.nix @@ -59,6 +59,8 @@ let tagaspi = callPackage ./pkgs/tagaspi/default.nix { }; tampi = callPackage ./pkgs/tampi/default.nix { }; upc-qaire-exporter = prev.callPackage ./pkgs/upc-qaire-exporter/default.nix { }; + tasycl = callPackage ./pkgs/tasycl/default.nix { }; + tasycl-acpp = callPackage ./pkgs/tasycl/default.nix { useIntel = false; }; wxparaver = callPackage ./pkgs/paraver/default.nix { }; }; diff --git a/pkgs/tasycl/default.nix b/pkgs/tasycl/default.nix new file mode 100644 index 00000000..de308041 --- /dev/null +++ b/pkgs/tasycl/default.nix @@ -0,0 +1,94 @@ +{ stdenv +, lib +, withCFlags +, intelPackages +, fetchFromGitHub +, automake +, autoconf +, libtool +, gnumake +, autoreconfHook +, boost +, adaptivecpp ? null +, useIntel ? true + +, useGit ? false +, gitUrl ? "git@gitlab-internal.bsc.es:task-awareness/tasycl/tasycl.git" +, gitBranch ? "main" +, gitCommit ? "78f98dcf60a66e0eaa3b4ebcf55be076bec64825" +}: + +assert (useIntel || adaptivecpp != null); + +let + variant = if useIntel then "intel" else "acpp"; + + syclStdenv = + if useIntel then + # If we don't set optimization level, separateDebugInfo sets ggdb and + # intel disables all optimizations + withCFlags ["-O3"] intelPackages.stdenv + else + withCFlags [ "-L${adaptivecpp}/lib" "-lacpp-rt" "-I${adaptivecpp}/include" ] stdenv + ; + + release = rec { + version = "2.1.0"; + src = fetchFromGitHub { + owner = "bsc-pm"; + repo = "tasycl"; + rev = version; + hash = "sha256-0kXnb0lHeQNHR27GTLbJ8xbiICLU8k2+FqEnnFSrzzo="; + }; + }; + + git = rec { + version = src.shortRev; + src = builtins.fetchGit { + url = gitUrl; + ref = gitBranch; + rev = gitCommit; + }; + }; + + source = if (useGit) then git else release; + + isOldRelease = (!useGit && (builtins.compareVersions source.version "2.0.0" <= 0)); + +in + +assert !isOldRelease || useIntel; # old releases only work with intel + +syclStdenv.mkDerivation { + pname = "tasycl"; + inherit (source) src version; + + enableParallelBuilding = true; + separateDebugInfo = true; + + nativeBuildInputs = [ + autoreconfHook + automake + autoconf + libtool + gnumake + ]; + + buildInputs = [ + boost + ]; + + # only needed for release versions prior or equal to 2.0.0 + configureFlags = lib.optionals isOldRelease [ "--with-sycl-include=${intelPackages.icx.cc}/include/sycl" ]; + + # add symlinks so we can explicitly link with tasycl-intel / tasycl-acpp + postInstall = '' + pushd $out/lib + for i in libtasycl* ; do + ln -s "$i" "''\${i/tasycl/tasycl-${variant}}" + done + popd + ''; + + hardeningDisable = [ "all" ]; +}