some fixup

This commit is contained in:
2024-11-23 10:57:55 +08:00
parent 5b4b8c6889
commit 2eb20cf492
2 changed files with 29 additions and 23 deletions

View File

@@ -100,7 +100,13 @@ inputs: rec
spectroscopy = inputs.pkgs.callPackage ./spectroscopy.nix { src = inputs.topInputs.spectroscopy; };
mirism = inputs.pkgs.callPackage ./mirism { inherit biu; stdenv = inputs.pkgs.clang18Stdenv; };
vaspberry = inputs.pkgs.callPackage ./vaspberry.nix { src = inputs.topInputs.vaspberry; };
nvhpcStdenv = inputs.pkgs.callPackage ./nvhpcStdenv.nix { src = inputs.topInputs.self.src.nvhpc; };
nvhpcStdenv = inputs.pkgs.callPackage ./nvhpcStdenv.nix
{
src = inputs.topInputs.self.src.nvhpc;
# stdenv = inputs.pkgs.cudaPackages.backendStdenv;
# gcc = inputs.pkgs.cudaPackages.backendStdenv.cc;
# gfortran = inputs.pkgs.cudaPackages.backendStdenv.cc.version
};
fmt-nvhpc = inputs.pkgs.fmt.override { stdenv = nvhpcStdenv; };
gccFull = inputs.pkgs.symlinkJoin
{

View File

@@ -1,15 +1,15 @@
{ src, stdenv, gcc, glibc_multi, autoPatchelfHook, libz, wrapCCWith, config, gfortran, overrideCC, zstd, libxml2, symlinkJoin, flock, glibc, binutils, writeText, addAttrsToDerivation, iconv, rdma-core }:
{ src, stdenv, gcc, glibc_multi, autoPatchelfHook, libz, wrapCCWith, config, gfortran, overrideCC, zstd, libxml2, symlinkJoin, flock, glibc, binutils, writeText, addAttrsToDerivation, iconv, rdma-core, numactl, ncurses }:
let
gccFull = symlinkJoin
gcc-combined = symlinkJoin
{
name = "gcc";
name = "gcc-combined";
paths =
[
gcc gfortran glibc_multi gcc.cc.lib
gcc gfortran glibc_multi.out gcc.cc.lib
# wrapped binaries
# stdenv.cc gfortran glibc glibc.dev binutils iconv
# not wrapped binaries
# stdenv.cc.cc stdenv.cc.cc.lib gfortran.cc binutils.bintools
gcc.cc gfortran.cc gfortran.cc.lib
];
};
unwrapped = stdenv.mkDerivation
@@ -17,33 +17,32 @@ let
pname = "nvhpc-unwrapped";
inherit (src) src version;
langFortran = true;
buildInputs = [ gccFull libz libxml2 zstd rdma-core ];
buildInputs = [ gcc-combined libz libxml2 zstd numactl ncurses ];
nativeBuildInputs = [ autoPatchelfHook flock ];
dontConfigure = true;
dontBuild = true;
dontStrip = true;
installPhase =
''
export NVHPC_SILENT=true
export NVHPC_INSTALL_TYPE=single
export NVHPC_INSTALL_DIR=$out/share/nvhpc
patchShebangs install_components ./install
sed -i '/makelocalrc executed by/d' install_components/Linux_x86_64/${src.version}/compilers/bin/makelocalrc
./install
# remove files we did not need
rm -rf $out/share/nvhpc/Linux_x86_64/${src.version}/{comm_libs}
# install component
mkdir -p $out
cp -r install_components/Linux_x86_64/${src.version}/compilers/{bin,include,lib,share} $out
# create localrc
patchShebangs $out/bin/makelocalrc
sed -i '/makelocalrc executed by/d' $out/bin/makelocalrc
$out/bin/makelocalrc $out/bin -x
# $out/bin/tools could not be moved to $out/share
'';
};
customLocalrc = writeText "localrc"
''
set LLVMDIR=${unwrapped}/share/llvm;
set CPPCOMPDIR=${unwrapped}/share/tools;
set CCOMPDIR=${unwrapped}/share/tools;
set DEFLIBDIR=${gccFull}/lib;
set DEFSTDOBJDIR=${gccFull}/lib;
set COMPBIN=${unwrapped}/bin;
set PGILD="-T${unwrapped}/lib/nvhpc.ld";
prepend PATH ${unwrapped}/lib/tools;
set DEFLIBDIR=${gcc-combined}/lib;
set DEFSTDOBJDIR=${gcc-combined}/lib;
'';
cudaCapability = builtins.concatStringsSep ","
(builtins.map (cap: "cc${builtins.replaceStrings ["."] [""] cap}") config.cudaCapabilities);
@@ -55,13 +54,13 @@ let
echo "-isystem ${unwrapped}/include" >> $out/nix-support/cc-cflags
# echo "-L${stdenv.cc.cc}/lib/gcc/${stdenv.targetPlatform.config}/${stdenv.cc.version}" >> $out/nix-support/cc-ldflags
# echo "-L${stdenv.cc.cc.lib}/lib" >> $out/nix-support/cc-ldflags
# echo "-L${unwrapped}/lib" >> $out/nix-support/cc-ldflags
echo "-L${unwrapped}/lib -L${gcc-combined}/lib --verbose" >> $out/nix-support/cc-ldflags
echo "-tp=${config.nvhpcArch}" >> $out/nix-support/cc-cflags-before
echo "-gpu=${cudaCapability} -#" >> $out/nix-support/cc-cflags-before
# Need the gcc in the path
# echo 'export "PATH=${gccFull}/bin:$PATH"' >> $out/nix-support/cc-wrapper-hook
# echo 'export "PATH=${gcc-combined}/bin:$PATH"' >> $out/nix-support/cc-wrapper-hook
echo "-# -noswitcherror" >> $out/nix-support/cc-cflags
# Disable hardening by default
@@ -76,3 +75,4 @@ let
export named_cxx=nvc++
export named_fc=nvfortran''; });
in addAttrsToDerivation { NVLOCALRC = customLocalrc; } (overrideCC stdenv nvhpc)
# NIX_DEBUG = "7";