forked from rarias/jungle
Compare commits
12 Commits
pkgs/pocl
...
fix/cross/
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a75fc3c5a | |||
| 1cbedcb2ad | |||
| c9cc7bd060 | |||
| 9ac0e697d1 | |||
| 4f643f4603 | |||
| 996c99d5eb | |||
| f9c6f7d751 | |||
| 00a1133019 | |||
| 859eebda98 | |||
| c2a201b085 | |||
| f921f0a4bd | |||
| aa16bfc0bc |
8
flake.lock
generated
8
flake.lock
generated
@@ -2,16 +2,16 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764522689,
|
"lastModified": 1752436162,
|
||||||
"narHash": "sha256-SqUuBFjhl/kpDiVaKLQBoD8TLD+/cTUzzgVFoaHrkqY=",
|
"narHash": "sha256-Kt1UIPi7kZqkSc5HVj6UY5YLHHEzPBkgpNUByuyxtlw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "8bb5646e0bed5dbd3ab08c7a7cc15b75ab4e1d0f",
|
"rev": "dfcd5b901dbab46c9c6e80b265648481aafb01f8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-25.11",
|
"ref": "nixos-25.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... }:
|
outputs = { self, nixpkgs, ... }:
|
||||||
|
|||||||
@@ -57,6 +57,18 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.fail2ban = {
|
||||||
|
enable = true;
|
||||||
|
maxretry = 5;
|
||||||
|
bantime-increment = {
|
||||||
|
enable = true; # Double ban time on each attack
|
||||||
|
maxtime = "7d"; # Ban up to a week
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Disable SSH login with password, allow only keypair
|
||||||
|
services.openssh.settings.PasswordAuthentication = false;
|
||||||
|
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
extraCommands = ''
|
extraCommands = ''
|
||||||
# Blackhole BSC vulnerability scanner (OpenVAS) as it is spamming our
|
# Blackhole BSC vulnerability scanner (OpenVAS) as it is spamming our
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, config, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
vim wget git htop tmux pciutils tcpdump ripgrep nix-index nixos-option
|
vim wget git htop tmux pciutils tcpdump ripgrep nix-index nixos-option
|
||||||
nix-diff ipmitool freeipmi ethtool lm_sensors cmake gnumake file tree
|
nix-diff ipmitool freeipmi ethtool lm_sensors cmake gnumake file tree
|
||||||
ncdu perf ldns pv
|
ncdu config.boot.kernelPackages.perf ldns pv
|
||||||
# From jungle overlay
|
# From jungle overlay
|
||||||
osumb nixgen
|
osumb nixgen
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -139,6 +139,7 @@
|
|||||||
openssh.authorizedKeys.keys = [
|
openssh.authorizedKeys.keys = [
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKGt0ESYxekBiHJQowmKpfdouw0hVm3N7tUMtAaeLejK vincent@varch"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKGt0ESYxekBiHJQowmKpfdouw0hVm3N7tUMtAaeLejK vincent@varch"
|
||||||
];
|
];
|
||||||
|
shell = pkgs.zsh;
|
||||||
};
|
};
|
||||||
|
|
||||||
pmartin1 = {
|
pmartin1 = {
|
||||||
|
|||||||
@@ -5,5 +5,5 @@
|
|||||||
boot.kernelModules = [ "ipmi_watchdog" ];
|
boot.kernelModules = [ "ipmi_watchdog" ];
|
||||||
|
|
||||||
# Enable systemd watchdog with 30 s interval
|
# Enable systemd watchdog with 30 s interval
|
||||||
systemd.settings.Manager.RuntimeWatchdogSec = 30;
|
systemd.watchdog.runtimeTime = "30s";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
{
|
{
|
||||||
services.nixseparatedebuginfod2 = {
|
services.nixseparatedebuginfod.enable = true;
|
||||||
enable = true;
|
|
||||||
substituters = [
|
|
||||||
"local:"
|
|
||||||
"https://cache.nixos.org"
|
|
||||||
"http://hut/cache"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
26
overlay.nix
26
overlay.nix
@@ -12,9 +12,9 @@ let
|
|||||||
bench6 = callPackage ./pkgs/bench6/default.nix { };
|
bench6 = callPackage ./pkgs/bench6/default.nix { };
|
||||||
bigotes = callPackage ./pkgs/bigotes/default.nix { };
|
bigotes = callPackage ./pkgs/bigotes/default.nix { };
|
||||||
clangOmpss2 = callPackage ./pkgs/llvm-ompss2/default.nix { };
|
clangOmpss2 = callPackage ./pkgs/llvm-ompss2/default.nix { };
|
||||||
clangOmpss2Nanos6 = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nanos6; };
|
clangOmpss2Nanos6 = callPackage ./pkgs/llvm-ompss2/default.nix { useNanos6 = true; };
|
||||||
clangOmpss2Nodes = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nodes; openmp = final.openmp; };
|
clangOmpss2Nodes = callPackage ./pkgs/llvm-ompss2/default.nix { useNodes = true; useOpenmp = true; };
|
||||||
clangOmpss2NodesOmpv = callPackage ./pkgs/llvm-ompss2/default.nix { ompss2rt = final.nodes; openmp = final.openmpv; };
|
clangOmpss2NodesOmpv = callPackage ./pkgs/llvm-ompss2/default.nix { useNodes = true; useOpenmpV = true; };
|
||||||
clangOmpss2Unwrapped = callPackage ./pkgs/llvm-ompss2/clang.nix { };
|
clangOmpss2Unwrapped = callPackage ./pkgs/llvm-ompss2/clang.nix { };
|
||||||
cudainfo = prev.callPackage ./pkgs/cudainfo/default.nix { };
|
cudainfo = prev.callPackage ./pkgs/cudainfo/default.nix { };
|
||||||
#extrae = callPackage ./pkgs/extrae/default.nix { }; # Broken and outdated
|
#extrae = callPackage ./pkgs/extrae/default.nix { }; # Broken and outdated
|
||||||
@@ -30,8 +30,7 @@ let
|
|||||||
amd-uprof-driver = _prev.callPackage ./pkgs/amd-uprof/driver.nix { };
|
amd-uprof-driver = _prev.callPackage ./pkgs/amd-uprof/driver.nix { };
|
||||||
});
|
});
|
||||||
lmbench = callPackage ./pkgs/lmbench/default.nix { };
|
lmbench = callPackage ./pkgs/lmbench/default.nix { };
|
||||||
# Broken and unmantained
|
mcxx = callPackage ./pkgs/mcxx/default.nix { };
|
||||||
# mcxx = callPackage ./pkgs/mcxx/default.nix { };
|
|
||||||
meteocat-exporter = prev.callPackage ./pkgs/meteocat-exporter/default.nix { };
|
meteocat-exporter = prev.callPackage ./pkgs/meteocat-exporter/default.nix { };
|
||||||
mpi = final.mpich; # Set MPICH as default
|
mpi = final.mpich; # Set MPICH as default
|
||||||
mpich = callPackage ./pkgs/mpich/default.nix { mpich = prev.mpich; };
|
mpich = callPackage ./pkgs/mpich/default.nix { mpich = prev.mpich; };
|
||||||
@@ -50,17 +49,15 @@ let
|
|||||||
ovni = callPackage ./pkgs/ovni/default.nix { };
|
ovni = callPackage ./pkgs/ovni/default.nix { };
|
||||||
ovniGit = final.ovni.override { useGit = true; };
|
ovniGit = final.ovni.override { useGit = true; };
|
||||||
paraverKernel = callPackage ./pkgs/paraver/kernel.nix { };
|
paraverKernel = callPackage ./pkgs/paraver/kernel.nix { };
|
||||||
pocl = callPackage ./pkgs/pocl/default.nix { };
|
|
||||||
pocl-noicd = callPackage ./pkgs/pocl/default.nix { enableICD = false; };
|
|
||||||
prometheus-slurm-exporter = prev.callPackage ./pkgs/slurm-exporter/default.nix { };
|
prometheus-slurm-exporter = prev.callPackage ./pkgs/slurm-exporter/default.nix { };
|
||||||
#pscom = callPackage ./pkgs/parastation/pscom.nix { }; # Unmaintaned
|
#pscom = callPackage ./pkgs/parastation/pscom.nix { }; # Unmaintaned
|
||||||
#psmpi = callPackage ./pkgs/parastation/psmpi.nix { }; # Unmaintaned
|
#psmpi = callPackage ./pkgs/parastation/psmpi.nix { }; # Unmaintaned
|
||||||
slurm = import ./pkgs/slurm/default.nix { slurm = prev.slurm; };
|
slurm = import ./pkgs/slurm/default.nix { slurm = prev.slurm; };
|
||||||
sonar = callPackage ./pkgs/sonar/default.nix { };
|
sonar = callPackage ./pkgs/sonar/default.nix { };
|
||||||
stdenvClangOmpss2 = final.stdenv.override { cc = final.clangOmpss2; allowedRequisites = null; };
|
stdenvClangOmpss2 = final.stdenv.override { cc = final.buildPackages.clangOmpss2; allowedRequisites = null; };
|
||||||
stdenvClangOmpss2Nanos6 = final.stdenv.override { cc = final.clangOmpss2Nanos6; allowedRequisites = null; };
|
stdenvClangOmpss2Nanos6 = final.stdenv.override { cc = final.buildPackages.clangOmpss2Nanos6; allowedRequisites = null; };
|
||||||
stdenvClangOmpss2Nodes = final.stdenv.override { cc = final.clangOmpss2Nodes; allowedRequisites = null; };
|
stdenvClangOmpss2Nodes = final.stdenv.override { cc = final.buildPackages.clangOmpss2Nodes; allowedRequisites = null; };
|
||||||
stdenvClangOmpss2NodesOmpv = final.stdenv.override { cc = final.clangOmpss2NodesOmpv; allowedRequisites = null; };
|
stdenvClangOmpss2NodesOmpv = final.stdenv.override { cc = final.buildPackages.clangOmpss2NodesOmpv; allowedRequisites = null; };
|
||||||
tagaspi = callPackage ./pkgs/tagaspi/default.nix { };
|
tagaspi = callPackage ./pkgs/tagaspi/default.nix { };
|
||||||
tampi = callPackage ./pkgs/tampi/default.nix { };
|
tampi = callPackage ./pkgs/tampi/default.nix { };
|
||||||
upc-qaire-exporter = prev.callPackage ./pkgs/upc-qaire-exporter/default.nix { };
|
upc-qaire-exporter = prev.callPackage ./pkgs/upc-qaire-exporter/default.nix { };
|
||||||
@@ -98,13 +95,6 @@ let
|
|||||||
clangNosvOmpv-ld = callPackage ./test/compilers/clang-openmp-ld.nix {
|
clangNosvOmpv-ld = callPackage ./test/compilers/clang-openmp-ld.nix {
|
||||||
stdenv = final.stdenvClangOmpss2NodesOmpv;
|
stdenv = final.stdenvClangOmpss2NodesOmpv;
|
||||||
};
|
};
|
||||||
|
|
||||||
ocl-build = callPackage ./test/compilers/opencl.nix { };
|
|
||||||
ocl-build-noicd = callPackage ./test/compilers/opencl.nix { ocl-icd = final.pocl-noicd; };
|
|
||||||
|
|
||||||
pocl = callPackage ./test/compilers/pocl.nix { };
|
|
||||||
ocl-run-pocl = ocl-build.test-icd;
|
|
||||||
ocl-run-pocl-noicd = ocl-build-noicd.test-noicd;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# For now, only build toplevel packages in CI/Hydra
|
# For now, only build toplevel packages in CI/Hydra
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ in stdenv.mkDerivation {
|
|||||||
'';
|
'';
|
||||||
hardeningDisable = [ "pic" "format" ];
|
hardeningDisable = [ "pic" "format" ];
|
||||||
nativeBuildInputs = kernel.moduleBuildDependencies;
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||||
patches = [ ./makefile.patch ./hrtimer.patch ./remove-wr-rdmsrq.patch ];
|
patches = [ ./makefile.patch ./hrtimer.patch ];
|
||||||
makeFlags = [
|
makeFlags = [
|
||||||
"KERNEL_VERSION=${kernel.modDirVersion}"
|
"KERNEL_VERSION=${kernel.modDirVersion}"
|
||||||
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
diff --git a/inc/PwrProfAsm.h b/inc/PwrProfAsm.h
|
|
||||||
index d77770a..c93a0e9 100644
|
|
||||||
--- a/inc/PwrProfAsm.h
|
|
||||||
+++ b/inc/PwrProfAsm.h
|
|
||||||
@@ -347,6 +347,7 @@
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+/*
|
|
||||||
#define rdmsrq(msr,val1,val2,val3,val4) ({ \
|
|
||||||
__asm__ __volatile__( \
|
|
||||||
"rdmsr\n" \
|
|
||||||
@@ -362,6 +363,7 @@
|
|
||||||
:"c"(msr), "a"(val1), "d"(val2), "S"(val3), "D"(val4) \
|
|
||||||
); \
|
|
||||||
})
|
|
||||||
+*/
|
|
||||||
|
|
||||||
#define rdmsrpw(msr,val1,val2,val3,val4) ({ \
|
|
||||||
__asm__ __volatile__( \
|
|
||||||
@@ -12,7 +12,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
src = ./.;
|
src = ./.;
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
cudatoolkit # Required for nvcc
|
cudatoolkit # Required for nvcc
|
||||||
(lib.getOutput "static" cudaPackages.cuda_cudart) # Required for -lcudart_static
|
cudaPackages.cuda_cudart.static # Required for -lcudart_static
|
||||||
autoAddDriverRunpath
|
autoAddDriverRunpath
|
||||||
];
|
];
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
, zlib
|
, zlib
|
||||||
, autoPatchelfHook
|
, autoPatchelfHook
|
||||||
, libfabric
|
, libfabric
|
||||||
, gcc
|
, gcc13
|
||||||
, wrapCCWith
|
, wrapCCWith
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@@ -33,6 +33,8 @@ let
|
|||||||
maintainers = with lib.maintainers.bsc; [ abonerib ];
|
maintainers = with lib.maintainers.bsc; [ abonerib ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gcc = gcc13;
|
||||||
|
|
||||||
v = {
|
v = {
|
||||||
hpckit = "2023.1.0";
|
hpckit = "2023.1.0";
|
||||||
compiler = "2023.1.0";
|
compiler = "2023.1.0";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
llvmPackages_latest
|
stdenv
|
||||||
|
, llvmPackages_latest
|
||||||
, lib
|
, lib
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, cmake
|
, cmake
|
||||||
, bash
|
|
||||||
, python3
|
, python3
|
||||||
, perl
|
, perl
|
||||||
, which
|
, which
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
, libffi
|
, libffi
|
||||||
, zlib
|
, zlib
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, gcc # needed to set the rpath of libstdc++ for clang-tblgen
|
|
||||||
, enableDebug ? false
|
, enableDebug ? false
|
||||||
, useGit ? false
|
, useGit ? false
|
||||||
, gitUrl ? "ssh://git@bscpm04.bsc.es/llvm-ompss/llvm-mono.git"
|
, gitUrl ? "ssh://git@bscpm04.bsc.es/llvm-ompss/llvm-mono.git"
|
||||||
@@ -20,7 +19,10 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
stdenv = llvmPackages_latest.stdenv;
|
llvmPackages = llvmPackages_latest;
|
||||||
|
llvmStdenv = llvmPackages.stdenv;
|
||||||
|
# needed to set the rpath of libstdc++ for clang-tblgen
|
||||||
|
gcc = stdenv.cc;
|
||||||
|
|
||||||
release = rec {
|
release = rec {
|
||||||
version = "2025.11";
|
version = "2025.11";
|
||||||
@@ -43,7 +45,7 @@ let
|
|||||||
|
|
||||||
source = if (useGit) then git else release;
|
source = if (useGit) then git else release;
|
||||||
|
|
||||||
in stdenv.mkDerivation {
|
in llvmStdenv.mkDerivation {
|
||||||
pname = "clang-ompss2";
|
pname = "clang-ompss2";
|
||||||
inherit (source) src version;
|
inherit (source) src version;
|
||||||
|
|
||||||
@@ -60,13 +62,12 @@ in stdenv.mkDerivation {
|
|||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
bash
|
|
||||||
cmake
|
cmake
|
||||||
elfutils
|
elfutils
|
||||||
llvmPackages_latest.lld
|
llvmPackages.lld
|
||||||
|
perl
|
||||||
pkg-config
|
pkg-config
|
||||||
python3
|
python3
|
||||||
perl
|
|
||||||
which
|
which
|
||||||
zlib
|
zlib
|
||||||
];
|
];
|
||||||
@@ -97,8 +98,13 @@ in stdenv.mkDerivation {
|
|||||||
cd build
|
cd build
|
||||||
cmakeDir="../llvm"
|
cmakeDir="../llvm"
|
||||||
cmakeFlagsArray=(
|
cmakeFlagsArray=(
|
||||||
"-DLLVM_HOST_TRIPLE=${stdenv.targetPlatform.config}"
|
"-DLLVM_HOST_TRIPLE=${llvmStdenv.targetPlatform.config}"
|
||||||
|
'' + (if "${llvmStdenv.targetPlatform.config}" == "riscv64-unknown-linux-gnu" then ''
|
||||||
|
"-DLLVM_DEFAULT_TARGET_TRIPLE=riscv64-unknown-linux-gnu"
|
||||||
|
"-DLLVM_TARGETS_TO_BUILD=RISCV"
|
||||||
|
'' else ''
|
||||||
"-DLLVM_TARGETS_TO_BUILD=host"
|
"-DLLVM_TARGETS_TO_BUILD=host"
|
||||||
|
'') + ''
|
||||||
"-DLLVM_BUILD_LLVM_DYLIB=ON"
|
"-DLLVM_BUILD_LLVM_DYLIB=ON"
|
||||||
"-DLLVM_LINK_LLVM_DYLIB=ON"
|
"-DLLVM_LINK_LLVM_DYLIB=ON"
|
||||||
# Required to run clang-ast-dump and clang-tblgen during build
|
# Required to run clang-ast-dump and clang-tblgen during build
|
||||||
@@ -107,7 +113,8 @@ in stdenv.mkDerivation {
|
|||||||
"-DCMAKE_CXX_FLAGS_DEBUG=-g -ggnu-pubnames"
|
"-DCMAKE_CXX_FLAGS_DEBUG=-g -ggnu-pubnames"
|
||||||
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=-Wl,--gdb-index"
|
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=-Wl,--gdb-index"
|
||||||
"-DLLVM_LIT_ARGS=-sv --xunit-xml-output=xunit.xml"
|
"-DLLVM_LIT_ARGS=-sv --xunit-xml-output=xunit.xml"
|
||||||
"-DLLVM_ENABLE_PROJECTS=clang;compiler-rt;lld"
|
"-DLLVM_ENABLE_PROJECTS=clang;lld"
|
||||||
|
#"-DLLVM_ENABLE_PROJECTS=clang;compiler-rt;lld"
|
||||||
"-DLLVM_ENABLE_ASSERTIONS=ON"
|
"-DLLVM_ENABLE_ASSERTIONS=ON"
|
||||||
"-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON"
|
"-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON"
|
||||||
"-DCMAKE_INSTALL_BINDIR=bin"
|
"-DCMAKE_INSTALL_BINDIR=bin"
|
||||||
@@ -117,8 +124,8 @@ in stdenv.mkDerivation {
|
|||||||
# install
|
# install
|
||||||
"-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON"
|
"-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON"
|
||||||
"-DCMAKE_INSTALL_RPATH=${zlib}/lib:${gcc.cc.lib}/lib"
|
"-DCMAKE_INSTALL_RPATH=${zlib}/lib:${gcc.cc.lib}/lib"
|
||||||
"-DLLVM_APPEND_VC_REV=ON"
|
#"-DLLVM_APPEND_VC_REV=ON"
|
||||||
"-DLLVM_FORCE_VC_REVISION=${source.version}"
|
#"-DLLVM_FORCE_VC_REVISION=${source.version}"
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|||||||
@@ -3,46 +3,65 @@
|
|||||||
, lib
|
, lib
|
||||||
, gcc
|
, gcc
|
||||||
, clangOmpss2Unwrapped
|
, clangOmpss2Unwrapped
|
||||||
, openmp ? null
|
|
||||||
|
, openmp
|
||||||
|
, useOpenmp ? false
|
||||||
|
, openmpv
|
||||||
|
, useOpenmpV ? false
|
||||||
|
, nanos6
|
||||||
|
, useNanos6 ? false
|
||||||
|
, nodes
|
||||||
|
, useNodes ? false
|
||||||
|
|
||||||
, wrapCCWith
|
, wrapCCWith
|
||||||
, llvmPackages_latest
|
, llvmPackages_latest
|
||||||
, ompss2rt ? null
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
usingNodesAndOmpv = (openmp.pname == "openmp-v" && ompss2rt.pname == "nodes");
|
getSplice = target: pkg: if pkg ? "__spliced" && pkg.__spliced ? target then pkg.__spliced."${target}" else pkg;
|
||||||
sameNosv = openmp.nosv == ompss2rt.nosv;
|
#getSpliceTargetTarget = pkg: if pkg ? "__spliced" && pkg.__spliced ? "targetTarget" then pkg.__spliced.targetTarget else pkg;
|
||||||
|
getSpliceTargetTarget = getSplice "targetTarget";
|
||||||
|
omp = if useOpenmp then openmp else if useOpenmpV then openmpv else null;
|
||||||
|
ompss2rtUnspliced = if useNanos6 then nanos6 else if useNodes then nodes else null;
|
||||||
|
ompss2rt = getSpliceTargetTarget ompss2rtUnspliced;
|
||||||
|
usingNodesAndOmpv = (omp.pname == "openmp-v" && ompss2rt.pname == "nodes");
|
||||||
|
sameNosvUnspliced = omp.nosv == ompss2rtUnspliced.nosv;
|
||||||
|
sameNosvSpliced = (getSpliceTargetTarget omp.nosv) == ompss2rt.nosv;
|
||||||
in
|
in
|
||||||
|
|
||||||
assert assertMsg (usingNodesAndOmpv -> sameNosv) "OpenMP-V and NODES must share the same nOS-V";
|
assert assertMsg (usingNodesAndOmpv -> sameNosvUnspliced) "OpenMP-V and NODES must share the same nOS-V before splice";
|
||||||
|
assert assertMsg (usingNodesAndOmpv -> sameNosvSpliced) "OpenMP-V and NODES must share the same nOS-V after splice";
|
||||||
|
assert assertMsg (useOpenmp -> !useOpenmpV) "Either OpenMP or OpenMP-V may be enabled, but not both";
|
||||||
|
assert assertMsg (useNanos6 -> !useNodes) "Either Nanos6 or NODES may be enabled, but not both";
|
||||||
|
|
||||||
let
|
let
|
||||||
homevar = if ompss2rt.pname == "nanos6" then "NANOS6_HOME" else "NODES_HOME";
|
homevar = if ompss2rt.pname == "nanos6" then "NANOS6_HOME" else "NODES_HOME";
|
||||||
rtname = if ompss2rt.pname == "nanos6" then "libnanos6" else "libnodes";
|
rtname = if ompss2rt.pname == "nanos6" then "libnanos6" else "libnodes";
|
||||||
ompname = if openmp.pname == "openmp-v" then "libompv" else "libomp";
|
ompname = if omp.pname == "openmp-v" then "libompv" else "libomp";
|
||||||
|
|
||||||
|
|
||||||
# We need to replace the lld linker from bintools with our linker just built,
|
# We need to replace the lld linker from bintools with our linker just built,
|
||||||
# otherwise we run into incompatibility issues when mixing compiler and linker
|
# otherwise we run into incompatibility issues when mixing compiler and linker
|
||||||
# versions.
|
# versions.
|
||||||
bintools-unwrapped = llvmPackages_latest.bintools-unwrapped.override {
|
bintools-unwrapped = llvmPackages_latest.tools.bintools-unwrapped.override {
|
||||||
lld = clangOmpss2Unwrapped;
|
lld = clangOmpss2Unwrapped;
|
||||||
};
|
};
|
||||||
bintools = llvmPackages_latest.bintools.override {
|
bintools = llvmPackages_latest.tools.bintools.override {
|
||||||
bintools = bintools-unwrapped;
|
bintools = bintools-unwrapped;
|
||||||
};
|
};
|
||||||
targetConfig = stdenv.targetPlatform.config;
|
targetConfig = stdenv.targetPlatform.config;
|
||||||
inherit gcc;
|
inherit gcc;
|
||||||
cc = clangOmpss2Unwrapped;
|
cc = clangOmpss2Unwrapped;
|
||||||
gccVersion = with versions; let v = gcc.version; in concatStringsSep "." [(major v) (minor v) (patch v)];
|
gccVersion = with versions; let v = gcc.version; in concatStringsSep "." [(major v) (minor v) (patch v)];
|
||||||
in wrapCCWith {
|
in (wrapCCWith {
|
||||||
inherit cc bintools;
|
inherit cc bintools;
|
||||||
# extraPackages adds packages to depsTargetTargetPropagated
|
# extraPackages adds packages to depsTargetTargetPropagated
|
||||||
extraPackages = optional (openmp != null) openmp;
|
extraPackages = optional (omp != null) omp;
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags
|
echo "-target ${targetConfig}" >> $out/nix-support/cc-cflags
|
||||||
|
#echo "-fuse-ld=lld" >> $out/nix-support/cc-cflags
|
||||||
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gccVersion}" >> $out/nix-support/cc-cflags
|
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gccVersion}" >> $out/nix-support/cc-cflags
|
||||||
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gccVersion}" >> $out/nix-support/cc-ldflags
|
echo "-L${gcc.cc}/lib/gcc/${targetConfig}/${gccVersion}" >> $out/nix-support/cc-ldflags
|
||||||
echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags
|
echo "-L${gcc.cc.lib}/lib" >> $out/nix-support/cc-ldflags
|
||||||
@@ -56,15 +75,17 @@ in wrapCCWith {
|
|||||||
|
|
||||||
echo "--gcc-toolchain=${gcc}" >> $out/nix-support/cc-cflags
|
echo "--gcc-toolchain=${gcc}" >> $out/nix-support/cc-cflags
|
||||||
|
|
||||||
wrap clang++ $wrapper $ccPath/clang++
|
wrap ${targetConfig}clang++ $wrapper $ccPath/clang++
|
||||||
|
wrap ${targetConfig}clang $wrapper $ccPath/clang
|
||||||
|
|
||||||
'' + optionalString (openmp != null) ''
|
'' + optionalString (omp != null) ''
|
||||||
echo "export OPENMP_RUNTIME=${ompname}" >> $out/nix-support/cc-wrapper-hook
|
echo "export OPENMP_RUNTIME=${ompname}" >> $out/nix-support/cc-wrapper-hook
|
||||||
'' + optionalString (ompss2rt != null) ''
|
'' + optionalString (ompss2rt != null) ''
|
||||||
echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook
|
echo "export OMPSS2_RUNTIME=${rtname}" >> $out/nix-support/cc-wrapper-hook
|
||||||
echo "export ${homevar}=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook
|
echo "export ${homevar}=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook
|
||||||
'' + optionalString (ompss2rt != null && ompss2rt.pname == "nodes") ''
|
'' + optionalString (ompss2rt != null && ompss2rt.pname == "nodes") ''
|
||||||
echo "export NOSV_HOME=${ompss2rt.nosv}" >> $out/nix-support/cc-wrapper-hook
|
echo "export NOSV_HOME=${ompss2rt}" >> $out/nix-support/cc-wrapper-hook
|
||||||
'';
|
'';
|
||||||
}
|
}) // { inherit ompss2rt; }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ stdenv.mkDerivation rec {
|
|||||||
perl
|
perl
|
||||||
pkg-config
|
pkg-config
|
||||||
python3
|
python3
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
] ++ lib.optionals enableNosv [
|
] ++ lib.optionals enableNosv [
|
||||||
nosv
|
nosv
|
||||||
] ++ lib.optionals enableOvni [
|
] ++ lib.optionals enableOvni [
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ stdenv.mkDerivation rec {
|
|||||||
];
|
];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
broken = true;
|
|
||||||
homepage = "https://github.com/bsc-pm/mcxx";
|
homepage = "https://github.com/bsc-pm/mcxx";
|
||||||
description = "C/C++/Fortran source-to-source compilation infrastructure aimed at fast prototyping";
|
description = "C/C++/Fortran source-to-source compilation infrastructure aimed at fast prototyping";
|
||||||
maintainers = with lib.maintainers.bsc; [ rpenacob ];
|
maintainers = with lib.maintainers.bsc; [ rpenacob ];
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
{ python3Packages, lib }:
|
{ python3Packages, lib }:
|
||||||
|
|
||||||
python3Packages.buildPythonApplication {
|
python3Packages.buildPythonApplication rec {
|
||||||
pname = "meteocat-exporter";
|
pname = "meteocat-exporter";
|
||||||
version = "1.0";
|
version = "1.0";
|
||||||
|
|
||||||
pyproject = true;
|
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
, paraverKernel
|
, paraverKernel
|
||||||
, openssl
|
, openssl
|
||||||
, glibcLocales
|
, glibcLocales
|
||||||
, wrapGAppsHook3
|
, wrapGAppsHook
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@@ -64,7 +64,7 @@ stdenv.mkDerivation rec {
|
|||||||
autoconf
|
autoconf
|
||||||
automake
|
automake
|
||||||
autoreconfHook
|
autoreconfHook
|
||||||
wrapGAppsHook3
|
wrapGAppsHook
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
From ccf301659caac9b5e973ba1f2d32352acf617a98 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Aleix=20Bon=C3=A9?= <aleix.boneribo@bsc.es>
|
|
||||||
Date: Tue, 2 Jul 2024 16:45:05 +0200
|
|
||||||
Subject: [PATCH] cmake: do not use suffix
|
|
||||||
|
|
||||||
---
|
|
||||||
cmake/LLVM.cmake | 3 ++
|
|
||||||
1 files changed, 3 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/cmake/LLVM.cmake b/cmake/LLVM.cmake
|
|
||||||
index f4dbda065..e29144dce 100644
|
|
||||||
--- a/cmake/LLVM.cmake
|
|
||||||
+++ b/cmake/LLVM.cmake
|
|
||||||
@@ -65,6 +65,9 @@ else()
|
|
||||||
message(WARNING "Cannot determine llvm binary suffix from ${LLVM_CONFIG}")
|
|
||||||
endif()
|
|
||||||
message(STATUS "LLVM binaries suffix : ${LLVM_BINARY_SUFFIX}")
|
|
||||||
+
|
|
||||||
+ # We don't want suffixes in nix
|
|
||||||
+ set(LLVM_BINARY_SUFFIX "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_filename_component(LLVM_CONFIG_LOCATION "${LLVM_CONFIG}" DIRECTORY)
|
|
||||||
--
|
|
||||||
2.45.1
|
|
||||||
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
From f24b456c50f587b05cc8f2699c94d8cdefc5b13e Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Aleix=20Bon=C3=A9?= <aleix.boneribo@bsc.es>
|
|
||||||
Date: Tue, 2 Jul 2024 17:11:11 +0200
|
|
||||||
Subject: [PATCH] cmake: native build tools
|
|
||||||
|
|
||||||
---
|
|
||||||
cmake/LLVM.cmake | 7 +-
|
|
||||||
1 files changed, 6 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/cmake/LLVM.cmake b/cmake/LLVM.cmake
|
|
||||||
index e29144dce..b9f14ce6a 100644
|
|
||||||
--- a/cmake/LLVM.cmake
|
|
||||||
+++ b/cmake/LLVM.cmake
|
|
||||||
@@ -269,10 +269,15 @@ endforeach()
|
|
||||||
|
|
||||||
####################################################################
|
|
||||||
|
|
||||||
+if(DEFINED LLVM_NATIVE_TOOL_DIR)
|
|
||||||
+ set(TOOL_DIR "${LLVM_NATIVE_TOOL_DIR}")
|
|
||||||
+ message(STATUS "TOOL_DIR=${TOOL_DIR}")
|
|
||||||
+endif()
|
|
||||||
+
|
|
||||||
macro(find_program_or_die OUTPUT_VAR PROG_NAME DOCSTRING)
|
|
||||||
find_program(${OUTPUT_VAR}
|
|
||||||
NAMES "${PROG_NAME}${LLVM_BINARY_SUFFIX}${CMAKE_EXECUTABLE_SUFFIX}"
|
|
||||||
- HINTS "${LLVM_BINDIR}" "${LLVM_CONFIG_LOCATION}"
|
|
||||||
+ HINTS "${TOOL_DIR}" "${LLVM_BINDIR}" "${LLVM_CONFIG_LOCATION}"
|
|
||||||
DOC "${DOCSTRING}"
|
|
||||||
NO_CMAKE_PATH
|
|
||||||
NO_CMAKE_ENVIRONMENT_PATH
|
|
||||||
--
|
|
||||||
2.45.1
|
|
||||||
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
From 4688b5ce895761c884ae15fc0234ed8d623b988b Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Aleix=20Bon=C3=A9?= <aleix.boneribo@bsc.es>
|
|
||||||
Date: Tue, 2 Jul 2024 15:41:47 +0200
|
|
||||||
Subject: [PATCH] cmake: use clang from cmake variable
|
|
||||||
|
|
||||||
---
|
|
||||||
cmake/LLVM.cmake | 22 ++++++++++++++++++++--
|
|
||||||
1 file changed, 20 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/cmake/LLVM.cmake b/cmake/LLVM.cmake
|
|
||||||
index 71b786dc7..f4dbda065 100644
|
|
||||||
--- a/cmake/LLVM.cmake
|
|
||||||
+++ b/cmake/LLVM.cmake
|
|
||||||
@@ -281,11 +281,29 @@ macro(find_program_or_die OUTPUT_VAR PROG_NAME DOCSTRING)
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
-find_program_or_die( CLANG "clang" "clang binary")
|
|
||||||
+# -DCMAKE_C_COMPILER=riscv64-unknown-linux-gnu-clang -DCMAKE_CXX_COMPILER=riscv64-unknown-linux-gnu-clang++
|
|
||||||
+
|
|
||||||
+# if(DEFINED CLANG_EXECUTABLE)
|
|
||||||
+if(DEFINED CMAKE_C_COMPILER)
|
|
||||||
+ # set(CLANG "${CLANG_EXECUTABLE}")
|
|
||||||
+ set(CLANG "${CMAKE_C_COMPILER}")
|
|
||||||
+ message(STATUS "Using CLANG_EXECUTABLE: ${CLANG}")
|
|
||||||
+else()
|
|
||||||
+ find_program_or_die( CLANG "clang" "clang binary")
|
|
||||||
+endif()
|
|
||||||
execute_process(COMMAND "${CLANG}" "--version" OUTPUT_VARIABLE LLVM_CLANG_VERSION RESULT_VARIABLE CLANG_RES)
|
|
||||||
+
|
|
||||||
# TODO this should be optional
|
|
||||||
-find_program_or_die( CLANGXX "clang++" "clang++ binary")
|
|
||||||
+# if(DEFINED CLANGXX_EXECUTABLE)
|
|
||||||
+if(DEFINED CMAKE_CXX_COMPILER)
|
|
||||||
+ # set(CLANGXX "${CLANGXX_EXECUTABLE}")
|
|
||||||
+ set(CLANGXX "${CMAKE_CXX_COMPILER}")
|
|
||||||
+ message(STATUS "Using CLANGXX_EXECUTABLE: ${CLANGXX}")
|
|
||||||
+else()
|
|
||||||
+ find_program_or_die( CLANGXX "clang++" "clang++ binary")
|
|
||||||
+endif()
|
|
||||||
execute_process(COMMAND "${CLANGXX}" "--version" OUTPUT_VARIABLE LLVM_CLANGXX_VERSION RESULT_VARIABLE CLANGXX_RES)
|
|
||||||
+
|
|
||||||
if(CLANGXX_RES OR CLANG_RES)
|
|
||||||
message(FATAL_ERROR "Failed running clang/clang++ --version")
|
|
||||||
endif()
|
|
||||||
--
|
|
||||||
2.45.1
|
|
||||||
|
|
||||||
@@ -1,227 +0,0 @@
|
|||||||
{
|
|
||||||
lib,
|
|
||||||
llvmPackages,
|
|
||||||
ninja,
|
|
||||||
cmake,
|
|
||||||
hwloc,
|
|
||||||
ocl-icd,
|
|
||||||
opencl-headers,
|
|
||||||
getconf,
|
|
||||||
pkg-config,
|
|
||||||
spirv-llvm-translator,
|
|
||||||
spirv-tools,
|
|
||||||
libxml2, # required for statically linked llvm
|
|
||||||
python3,
|
|
||||||
writableTmpDirAsHomeHook,
|
|
||||||
writeText,
|
|
||||||
|
|
||||||
fetchFromGitHub,
|
|
||||||
|
|
||||||
useGit ? false,
|
|
||||||
gitUrl ? "git@gitlab-internal.bsc.es:task-awareness/pocl/pocl.git",
|
|
||||||
gitBranch ? "new-device",
|
|
||||||
gitCommit ? "dd10c2221b31223cbb796182df6a07f11c7541f5",
|
|
||||||
|
|
||||||
staticLLVM ? true,
|
|
||||||
enableICD ? true,
|
|
||||||
enableSPIRV ? true,
|
|
||||||
enableHWLOC ? true,
|
|
||||||
enableRemoteServer ? false,
|
|
||||||
enableRemoteClient ? false,
|
|
||||||
enableDistroVariants ? false,
|
|
||||||
|
|
||||||
lttng-ust,
|
|
||||||
enableLTTNG ? false,
|
|
||||||
|
|
||||||
onetbb,
|
|
||||||
enableTBB ? false,
|
|
||||||
|
|
||||||
nosv ? null,
|
|
||||||
ovni ? null,
|
|
||||||
enableNOSV ? useGit,
|
|
||||||
enableOVNI ? useGit,
|
|
||||||
|
|
||||||
buildPackages,
|
|
||||||
targetPackages,
|
|
||||||
nix-update-script,
|
|
||||||
}:
|
|
||||||
|
|
||||||
assert (enableNOSV || enableOVNI) -> useGit;
|
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
release = rec {
|
|
||||||
version = "7.1";
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "pocl";
|
|
||||||
repo = "pocl";
|
|
||||||
tag = "v${version}";
|
|
||||||
hash = "sha256-bS6vTIjLO7YLs7qYLKW0cYYbEJ/hRS/+IjjAKbkj8ac=";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
git = rec {
|
|
||||||
version = src.shortRev;
|
|
||||||
src = builtins.fetchGit {
|
|
||||||
url = gitUrl;
|
|
||||||
ref = gitBranch;
|
|
||||||
rev = gitCommit;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
source = if (useGit) then git else release;
|
|
||||||
|
|
||||||
stdenv = llvmPackages.stdenv;
|
|
||||||
|
|
||||||
buildLlvmPackages = buildPackages.llvmPackages;
|
|
||||||
|
|
||||||
isCross = stdenv.hostPlatform != stdenv.buildPlatform;
|
|
||||||
|
|
||||||
featureList = lib.concatStringsSep "+" (
|
|
||||||
(lib.optionals enableICD [ "icd" ])
|
|
||||||
++ (lib.optionals enableNOSV [ "nosv" ])
|
|
||||||
++ (lib.optionals enableOVNI [ "ovni" ])
|
|
||||||
++ (lib.optionals enableSPIRV [ "spirv" ])
|
|
||||||
++ (lib.optionals enableTBB [ "tbb" ])
|
|
||||||
++ (lib.optionals enableRemoteClient [ "server" ])
|
|
||||||
++ (lib.optionals enableRemoteServer [ "client" ])
|
|
||||||
);
|
|
||||||
in
|
|
||||||
|
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
|
||||||
pname = "pocl";
|
|
||||||
version = featureList + "-" + source.version;
|
|
||||||
inherit (source) src;
|
|
||||||
|
|
||||||
patches = lib.optionals useGit [
|
|
||||||
./0001-cmake-use-clang-from-cmake-variable.patch
|
|
||||||
./0001-cmake-do-not-use-suffix.patch
|
|
||||||
./0001-cmake-native-build-tools.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
# TODO: all these are broken when cross compiling. Upstream has refactored
|
|
||||||
# all the cmake infra for cross compilation, but it's not in a release yet
|
|
||||||
(lib.cmakeOptionType "filepath" "WITH_LLVM_CONFIG" (
|
|
||||||
lib.getExe' buildLlvmPackages.llvm.dev "llvm-config"
|
|
||||||
))
|
|
||||||
(lib.cmakeOptionType "filepath" "CLANG" (lib.getExe' buildLlvmPackages.clangUseLLVM "clang"))
|
|
||||||
(lib.cmakeOptionType "filepath" "CLANGXX" (lib.getExe' buildLlvmPackages.clangUseLLVM "clang++"))
|
|
||||||
(lib.cmakeOptionType "path" "CLANG_RESOURCE_DIR" "${llvmPackages.stdenv.cc}/resource-root")
|
|
||||||
|
|
||||||
(lib.cmakeBool "ENABLE_TESTS" finalAttrs.finalPackage.doCheck)
|
|
||||||
|
|
||||||
(lib.cmakeBool "ENABLE_RELOCATION" true)
|
|
||||||
(lib.cmakeBool "ENABLE_POCL_BUILDING" true)
|
|
||||||
(lib.cmakeBool "POCL_ICD_ABSOLUTE_PATH" true)
|
|
||||||
|
|
||||||
(lib.cmakeBool "ENABLE_TBB_DEVICE" enableTBB)
|
|
||||||
(lib.cmakeBool "ENABLE_ICD" enableICD)
|
|
||||||
(lib.cmakeBool "ENABLE_HWLOC" enableHWLOC)
|
|
||||||
(lib.cmakeBool "ENABLE_LTTNG" enableLTTNG)
|
|
||||||
|
|
||||||
(lib.cmakeBool "ENABLE_REMOTE_CLIENT" enableRemoteClient)
|
|
||||||
(lib.cmakeBool "ENABLE_REMOTE_SERVER" enableRemoteServer)
|
|
||||||
|
|
||||||
# avoid the runtime linker pulling in a different llvm e.g. from graphics drivers
|
|
||||||
(lib.cmakeBool "STATIC_LLVM" staticLLVM)
|
|
||||||
]
|
|
||||||
++ lib.optionals (enableNOSV || enableOVNI) [
|
|
||||||
(lib.cmakeBool "ENABLE_NOSV" enableNOSV)
|
|
||||||
(lib.cmakeBool "ENABLE_OVNI" enableOVNI)
|
|
||||||
]
|
|
||||||
++ lib.optionals (!isCross && enableDistroVariants) [
|
|
||||||
(lib.cmakeFeature "KERNELLIB_HOST_CPU_VARIANTS" "distro") # TODO: check if we can do it when cross compiling
|
|
||||||
]
|
|
||||||
++ lib.optionals isCross [
|
|
||||||
(lib.cmakeFeature "CMAKE_SYSTEM_NAME" "Linux")
|
|
||||||
(lib.cmakeFeature "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM" "NEVER")
|
|
||||||
(lib.cmakeFeature "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY" "ONLY")
|
|
||||||
(lib.cmakeFeature "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE" "ONLY")
|
|
||||||
(lib.cmakeFeature "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE" "ONLY")
|
|
||||||
]
|
|
||||||
++ lib.optionals stdenv.hostPlatform.isRiscV [
|
|
||||||
(lib.cmakeFeature "LLC_TRIPLE" "riscv64-unknown-linux-gnu")
|
|
||||||
(lib.cmakeFeature "LLC_HOST_CPU" "rv64g")
|
|
||||||
(lib.cmakeFeature "CLANG_MARCH_FLAG" "-march=")
|
|
||||||
];
|
|
||||||
|
|
||||||
# Fixes error: ld: cannot find -lgcc / -lgcc_s when linking from libpocl on
|
|
||||||
# host
|
|
||||||
preConfigure = ''
|
|
||||||
cmakeFlagsArray+=(
|
|
||||||
-DEXTRA_HOST_LD_FLAGS="${lib.escapeShellArg (builtins.readFile "${targetPackages.stdenv.cc}/nix-support/cc-ldflags")}"
|
|
||||||
-DEXTRA_KERNEL_FLAGS="${lib.escapeShellArg (builtins.readFile "${targetPackages.stdenv.cc}/nix-support/cc-ldflags")}"
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
cmake
|
|
||||||
getconf
|
|
||||||
ninja
|
|
||||||
pkg-config
|
|
||||||
python3
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
opencl-headers
|
|
||||||
llvmPackages.libclang
|
|
||||||
llvmPackages.llvm
|
|
||||||
]
|
|
||||||
++ lib.optionals staticLLVM [ libxml2 ]
|
|
||||||
++ lib.optionals enableNOSV [ nosv ]
|
|
||||||
++ lib.optionals enableOVNI [ ovni ]
|
|
||||||
++ lib.optionals enableHWLOC [ hwloc ]
|
|
||||||
++ lib.optionals enableTBB [ onetbb ]
|
|
||||||
++ lib.optionals enableICD [ ocl-icd ]
|
|
||||||
++ lib.optionals enableLTTNG [ lttng-ust ]
|
|
||||||
++ lib.optionals enableSPIRV [
|
|
||||||
(spirv-llvm-translator.override { inherit (llvmPackages) llvm; })
|
|
||||||
spirv-tools
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeInstallCheckInputs = [
|
|
||||||
writableTmpDirAsHomeHook # needed for POCL_CACHE_DIR
|
|
||||||
];
|
|
||||||
|
|
||||||
doInstallCheck = true;
|
|
||||||
|
|
||||||
installCheckPhase = lib.optionalString enableICD ''
|
|
||||||
runHook preInstallCheck
|
|
||||||
|
|
||||||
export OCL_ICD_VENDORS=$out/etc/OpenCL/vendors
|
|
||||||
$out/bin/poclcc -o poclcc.cl.pocl $src/examples/poclcc/poclcc.cl
|
|
||||||
|
|
||||||
runHook postInstallCheck
|
|
||||||
'';
|
|
||||||
|
|
||||||
setupHook = lib.optionalDrvAttr enableICD (
|
|
||||||
writeText "setup-hook" ''
|
|
||||||
addToSearchPath OCL_ICD_VENDORS @out@/etc/OpenCL/vendors
|
|
||||||
''
|
|
||||||
);
|
|
||||||
|
|
||||||
passthru = {
|
|
||||||
updateScript = nix-update-script { };
|
|
||||||
git = finalAttrs.finalPackage.override { useGit = true; };
|
|
||||||
test = finalAttrs.finalPackage.overrideAttrs { doCheck = true; };
|
|
||||||
withICD = enableICD;
|
|
||||||
};
|
|
||||||
|
|
||||||
env.HWLOC_SYNTHETIC = lib.optionalDrvAttr enableHWLOC "node:1 core:1 pu:1";
|
|
||||||
|
|
||||||
propagatedBuildInputs = [ stdenv.cc.cc ];
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "A portable open source (MIT-licensed) implementation of the OpenCL standard";
|
|
||||||
homepage = "http://portablecl.org";
|
|
||||||
license = licenses.mit;
|
|
||||||
maintainers = with maintainers; [
|
|
||||||
leixb
|
|
||||||
jansol
|
|
||||||
xddxdd
|
|
||||||
bsc.maintainers.leixb
|
|
||||||
];
|
|
||||||
platforms = platforms.linux ++ platforms.darwin;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
{ python3Packages, lib }:
|
{ python3Packages, lib }:
|
||||||
|
|
||||||
python3Packages.buildPythonApplication {
|
python3Packages.buildPythonApplication rec {
|
||||||
pname = "upc-qaire-exporter";
|
pname = "upc-qaire-exporter";
|
||||||
version = "1.0";
|
version = "1.0";
|
||||||
|
|
||||||
pyproject = true;
|
|
||||||
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|||||||
@@ -1,127 +0,0 @@
|
|||||||
#include <CL/cl.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define BUF_LEN 128
|
|
||||||
|
|
||||||
cl_int exit_err = CL_SUCCESS;
|
|
||||||
|
|
||||||
#define CHECK(cmd) \
|
|
||||||
do { \
|
|
||||||
cl_int err = cmd; \
|
|
||||||
if (err != CL_SUCCESS) { \
|
|
||||||
printf("[ERROR] " #cmd " (Error code: %d)\n" \
|
|
||||||
"@ "__FILE__ \
|
|
||||||
":%d", \
|
|
||||||
err, __LINE__); \
|
|
||||||
exit_err = err; \
|
|
||||||
goto cleanup; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
const char *kernel_source = "__kernel void vector_add(__global const float *a, "
|
|
||||||
"__global const float *b, __global float *c) {\n"
|
|
||||||
" int gid = get_global_id(0);\n"
|
|
||||||
" c[gid] = a[gid] + b[gid];\n"
|
|
||||||
"}\n";
|
|
||||||
|
|
||||||
cl_int test_kernel_compilation(cl_platform_id platform) {
|
|
||||||
cl_device_id device = NULL;
|
|
||||||
cl_context context = NULL;
|
|
||||||
cl_program program = NULL;
|
|
||||||
cl_int err = CL_SUCCESS;
|
|
||||||
char device_name[BUF_LEN];
|
|
||||||
|
|
||||||
// Get first device for this platform
|
|
||||||
CHECK(clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &device, NULL));
|
|
||||||
|
|
||||||
// Get device name
|
|
||||||
CHECK(clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(device_name),
|
|
||||||
device_name, NULL));
|
|
||||||
printf(" Device: %s\n", device_name);
|
|
||||||
|
|
||||||
context = clCreateContext(NULL, 1, &device, NULL, NULL, &err);
|
|
||||||
CHECK(err);
|
|
||||||
|
|
||||||
program = clCreateProgramWithSource(context, 1, &kernel_source, NULL, &err);
|
|
||||||
CHECK(err);
|
|
||||||
|
|
||||||
err = clBuildProgram(program, 1, &device, NULL, NULL, NULL);
|
|
||||||
if (err != CL_SUCCESS) {
|
|
||||||
printf(" [ERROR] Kernel compilation failed (Error code: %d)\n", err);
|
|
||||||
|
|
||||||
// Build log
|
|
||||||
size_t log_size;
|
|
||||||
CHECK(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL,
|
|
||||||
&log_size));
|
|
||||||
char *log = (char *)malloc(log_size);
|
|
||||||
CHECK(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, log_size,
|
|
||||||
log, NULL));
|
|
||||||
printf(" Build log:\n%s\n", log);
|
|
||||||
free(log);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf(" [OK] Kernel compiled successfully!\n");
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
if (program)
|
|
||||||
clReleaseProgram(program);
|
|
||||||
if (context)
|
|
||||||
clReleaseContext(context);
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
return exit_err;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
cl_uint num_platforms;
|
|
||||||
cl_platform_id *platforms = NULL;
|
|
||||||
|
|
||||||
// Get number of platforms
|
|
||||||
CHECK(clGetPlatformIDs(0, NULL, &num_platforms));
|
|
||||||
|
|
||||||
printf("Found %d OpenCL platform(s)\n\n", num_platforms);
|
|
||||||
|
|
||||||
if (num_platforms == 0) {
|
|
||||||
printf("No OpenCL platforms found!\n");
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allocate memory for platforms
|
|
||||||
platforms = (cl_platform_id *)malloc(sizeof(cl_platform_id) * num_platforms);
|
|
||||||
|
|
||||||
// Get platform IDs
|
|
||||||
CHECK(clGetPlatformIDs(num_platforms, platforms, NULL));
|
|
||||||
|
|
||||||
// Query each platform and test kernel compilation
|
|
||||||
for (cl_uint i = 0; i < num_platforms; i++) {
|
|
||||||
char platform_name[BUF_LEN];
|
|
||||||
char platform_vendor[BUF_LEN];
|
|
||||||
char platform_version[BUF_LEN];
|
|
||||||
|
|
||||||
CHECK(clGetPlatformInfo(platforms[i], CL_PLATFORM_NAME,
|
|
||||||
sizeof(platform_name), platform_name, NULL));
|
|
||||||
CHECK(clGetPlatformInfo(platforms[i], CL_PLATFORM_VENDOR,
|
|
||||||
sizeof(platform_vendor), platform_vendor, NULL));
|
|
||||||
CHECK(clGetPlatformInfo(platforms[i], CL_PLATFORM_VERSION,
|
|
||||||
sizeof(platform_version), platform_version, NULL));
|
|
||||||
|
|
||||||
printf("Platform %d: %s\n", i, platform_name);
|
|
||||||
printf(" Vendor: %s\n", platform_vendor);
|
|
||||||
printf(" Version: %s\n", platform_version);
|
|
||||||
|
|
||||||
// Test kernel compilation
|
|
||||||
CHECK(test_kernel_compilation(platforms[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
if (platforms)
|
|
||||||
free(platforms);
|
|
||||||
|
|
||||||
if (exit_err == CL_SUCCESS)
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
{
|
|
||||||
stdenv,
|
|
||||||
ocl-icd,
|
|
||||||
opencl-headers,
|
|
||||||
pocl,
|
|
||||||
clinfo,
|
|
||||||
runCommand,
|
|
||||||
lib,
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
|
||||||
pname = "opencl-pocl-test";
|
|
||||||
version = "1.0.0";
|
|
||||||
|
|
||||||
src = ./opencl.c;
|
|
||||||
|
|
||||||
dontUnpack = true;
|
|
||||||
dontConfigure = true;
|
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
ocl-icd
|
|
||||||
opencl-headers
|
|
||||||
];
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
|
|
||||||
$CC -Wall -Wextra -D CL_TARGET_OPENCL_VERSION=100 $src -o ocl-hello -lOpenCL
|
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp ocl-hello $out/bin
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru = {
|
|
||||||
test-icd =
|
|
||||||
runCommand "custom-clinfo"
|
|
||||||
{
|
|
||||||
nativeBuildInputs =
|
|
||||||
assert !(lib.hasPrefix "pocl" ocl-icd.pname);
|
|
||||||
[
|
|
||||||
clinfo
|
|
||||||
finalAttrs.finalPackage
|
|
||||||
pocl
|
|
||||||
];
|
|
||||||
|
|
||||||
env = {
|
|
||||||
POCL_DEBUG = "error,warn";
|
|
||||||
POCL_CACHE_DIR = "/build/pocl_cache";
|
|
||||||
};
|
|
||||||
|
|
||||||
requiredSystemFeatures = [ "sys-devices" ];
|
|
||||||
}
|
|
||||||
|
|
||||||
''
|
|
||||||
set -x
|
|
||||||
|
|
||||||
mkdir $out
|
|
||||||
|
|
||||||
clinfo -l >$out/clinfo
|
|
||||||
clinfo >$out/clinfo-full
|
|
||||||
|
|
||||||
ocl-hello >$out/hello
|
|
||||||
|
|
||||||
for i in $out/*; do
|
|
||||||
grep "Portable Computing Language" $i
|
|
||||||
done
|
|
||||||
|
|
||||||
echo $OCL_ICD_VENDORS >$out/env
|
|
||||||
|
|
||||||
grep "pocl.*/etc/OpenCL/vendors" $out/env
|
|
||||||
|
|
||||||
set +x
|
|
||||||
'';
|
|
||||||
# this needs: ocl-icd = pocl-noicd
|
|
||||||
test-noicd =
|
|
||||||
runCommand "custom-clinfo"
|
|
||||||
{
|
|
||||||
nativeBuildInputs = [
|
|
||||||
finalAttrs.finalPackage
|
|
||||||
];
|
|
||||||
|
|
||||||
env = {
|
|
||||||
POCL_DEBUG = "error,warn";
|
|
||||||
POCL_CACHE_DIR = "/build/pocl_cache";
|
|
||||||
};
|
|
||||||
|
|
||||||
requiredSystemFeatures = [ "sys-devices" ];
|
|
||||||
}
|
|
||||||
|
|
||||||
''
|
|
||||||
ocl-hello >$out
|
|
||||||
|
|
||||||
grep "Portable Computing Language" $out
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
})
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
runCommand,
|
|
||||||
pocl,
|
|
||||||
clinfo,
|
|
||||||
}:
|
|
||||||
|
|
||||||
runCommand "clinfo-pocl"
|
|
||||||
{
|
|
||||||
nativeBuildInputs = [
|
|
||||||
clinfo
|
|
||||||
pocl
|
|
||||||
];
|
|
||||||
|
|
||||||
requiredSystemFeatures = [ "sys-devices" ];
|
|
||||||
|
|
||||||
env = {
|
|
||||||
POCL_DEBUG = "error,warn";
|
|
||||||
POCL_CACHE_DIR = "/build/pocl_cache";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
''
|
|
||||||
echo $OCL_ICD_VENDORS
|
|
||||||
clinfo >$out
|
|
||||||
|
|
||||||
# check that we have PoCL:
|
|
||||||
grep "Portable Computing Language" $out
|
|
||||||
''
|
|
||||||
Reference in New Issue
Block a user