Fix mpich cross compilation and clean up tagaspi #213
@ -9,7 +9,6 @@
 | 
				
			|||||||
, automake
 | 
					, automake
 | 
				
			||||||
, libtool
 | 
					, libtool
 | 
				
			||||||
, mpi
 | 
					, mpi
 | 
				
			||||||
, rsync
 | 
					 | 
				
			||||||
, gfortran
 | 
					, gfortran
 | 
				
			||||||
}:
 | 
					}:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -44,13 +43,24 @@ stdenv.mkDerivation rec {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  configureFlags = [
 | 
					  configureFlags = [
 | 
				
			||||||
    "--with-infiniband=${rdma-core-all}"
 | 
					    "--with-infiniband=${rdma-core-all}"
 | 
				
			||||||
    "--with-mpi=${mpiAll}"
 | 
					    "--with-mpi=yes" # fixes mpi detection when cross-compiling
 | 
				
			||||||
    "--with-slurm"
 | 
					    "--with-slurm"
 | 
				
			||||||
    "CFLAGS=-fPIC"
 | 
					    "CFLAGS=-fPIC"
 | 
				
			||||||
    "CXXFLAGS=-fPIC"
 | 
					    "CXXFLAGS=-fPIC"
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  buildInputs = [ slurm mpiAll rdma-core-all autoconf automake libtool rsync gfortran ];
 | 
					  nativeBuildInputs = [
 | 
				
			||||||
 | 
					    autoconf
 | 
				
			||||||
 | 
					    automake
 | 
				
			||||||
 | 
					    gfortran
 | 
				
			||||||
 | 
					    libtool
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  buildInputs = [
 | 
				
			||||||
 | 
					    slurm
 | 
				
			||||||
 | 
					    mpiAll
 | 
				
			||||||
 | 
					    rdma-core-all
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  hardeningDisable = [ "all" ];
 | 
					  hardeningDisable = [ "all" ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -60,5 +70,6 @@ stdenv.mkDerivation rec {
 | 
				
			|||||||
    maintainers = with lib.maintainers.bsc; [ rarias ];
 | 
					    maintainers = with lib.maintainers.bsc; [ rarias ];
 | 
				
			||||||
    platforms = lib.platforms.linux;
 | 
					    platforms = lib.platforms.linux;
 | 
				
			||||||
    license = lib.licenses.gpl3Plus;
 | 
					    license = lib.licenses.gpl3Plus;
 | 
				
			||||||
 | 
					    cross = false; # infiniband detection does not work
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,13 @@
 | 
				
			|||||||
, pmix
 | 
					, pmix
 | 
				
			||||||
, gfortran
 | 
					, gfortran
 | 
				
			||||||
, symlinkJoin
 | 
					, symlinkJoin
 | 
				
			||||||
 | 
					# Disabled when cross-compiling
 | 
				
			||||||
 | 
					# To fix cross compilation, we should fill the values in:
 | 
				
			||||||
 | 
					# https://github.com/pmodels/mpich/blob/main/maint/fcrosscompile/cross_values.txt.in
 | 
				
			||||||
 | 
					# For each arch
 | 
				
			||||||
 | 
					, enableFortran ? stdenv.hostPlatform == stdenv.buildPlatform
 | 
				
			||||||
 | 
					, perl
 | 
				
			||||||
 | 
					, targetPackages
 | 
				
			||||||
}:
 | 
					}:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let
 | 
					let
 | 
				
			||||||
@ -15,10 +22,13 @@ let
 | 
				
			|||||||
    paths = [ pmix.dev pmix.out ];
 | 
					    paths = [ pmix.dev pmix.out ];
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
in mpich.overrideAttrs (old: {
 | 
					in mpich.overrideAttrs (old: {
 | 
				
			||||||
  buildInput = old.buildInputs ++ [
 | 
					  buildInputs = old.buildInputs ++ [
 | 
				
			||||||
    libfabric
 | 
					    libfabric
 | 
				
			||||||
    pmixAll
 | 
					    pmixAll
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					  nativeBuildInputs = old.nativeBuildInputs ++ [
 | 
				
			||||||
 | 
					    perl
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
  configureFlags = [
 | 
					  configureFlags = [
 | 
				
			||||||
    "--enable-shared"
 | 
					    "--enable-shared"
 | 
				
			||||||
    "--enable-sharedlib"
 | 
					    "--enable-sharedlib"
 | 
				
			||||||
@ -31,10 +41,21 @@ in mpich.overrideAttrs (old: {
 | 
				
			|||||||
  ] ++ lib.optionals (lib.versionAtLeast gfortran.version "10") [
 | 
					  ] ++ lib.optionals (lib.versionAtLeast gfortran.version "10") [
 | 
				
			||||||
    "FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300
 | 
					    "FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300
 | 
				
			||||||
    "FCFLAGS=-fallow-argument-mismatch"
 | 
					    "FCFLAGS=-fallow-argument-mismatch"
 | 
				
			||||||
 | 
					  ] ++ lib.optionals (!enableFortran) [
 | 
				
			||||||
 | 
					    "--disable-fortran"
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  preFixup = ''
 | 
				
			||||||
 | 
					    sed -i 's:^CC=.*:CC=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' $out/bin/mpicc
 | 
				
			||||||
 | 
					    sed -i 's:^CXX=.*:CXX=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:' $out/bin/mpicxx
 | 
				
			||||||
 | 
					  '' + lib.optionalString enableFortran ''
 | 
				
			||||||
 | 
					    sed -i 's:^FC=.*:FC=${targetPackages.gfortran or gfortran}/bin/${targetPackages.gfortran.targetPrefix or gfortran.targetPrefix}gfortran:' $out/bin/mpifort
 | 
				
			||||||
 | 
					  '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  hardeningDisable = [ "all" ];
 | 
					  hardeningDisable = [ "all" ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  meta = old.meta // {
 | 
					  meta = old.meta // {
 | 
				
			||||||
    maintainers = old.meta.maintainers ++ (with lib.maintainers.bsc; [ rarias ]);
 | 
					    maintainers = old.meta.maintainers ++ (with lib.maintainers.bsc; [ rarias ]);
 | 
				
			||||||
 | 
					    cross = true;
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
				
			|||||||
@ -32,6 +32,11 @@ stdenv.mkDerivation rec {
 | 
				
			|||||||
      "CXX=mpicxx"
 | 
					      "CXX=mpicxx"
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  env = {
 | 
				
			||||||
 | 
					    MPICH_CC="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
 | 
				
			||||||
 | 
					    MPICH_CXX="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  postInstall = ''
 | 
					  postInstall = ''
 | 
				
			||||||
    mkdir -p $out/bin
 | 
					    mkdir -p $out/bin
 | 
				
			||||||
    for f in $(find $out -executable -type f); do
 | 
					    for f in $(find $out -executable -type f); do
 | 
				
			||||||
@ -44,5 +49,6 @@ stdenv.mkDerivation rec {
 | 
				
			|||||||
    homepage = "http://mvapich.cse.ohio-state.edu/benchmarks/";
 | 
					    homepage = "http://mvapich.cse.ohio-state.edu/benchmarks/";
 | 
				
			||||||
    maintainers = [ ];
 | 
					    maintainers = [ ];
 | 
				
			||||||
    platforms = lib.platforms.all;
 | 
					    platforms = lib.platforms.all;
 | 
				
			||||||
 | 
					    cross = true;
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -35,5 +35,6 @@ stdenv.mkDerivation rec {
 | 
				
			|||||||
    maintainers = with lib.maintainers.bsc; [ rarias ];
 | 
					    maintainers = with lib.maintainers.bsc; [ rarias ];
 | 
				
			||||||
    platforms = lib.platforms.linux;
 | 
					    platforms = lib.platforms.linux;
 | 
				
			||||||
    license = lib.licenses.mit;
 | 
					    license = lib.licenses.mit;
 | 
				
			||||||
 | 
					    cross = true;
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -5,23 +5,14 @@
 | 
				
			|||||||
, automake
 | 
					, automake
 | 
				
			||||||
, autoconf
 | 
					, autoconf
 | 
				
			||||||
, libtool
 | 
					, libtool
 | 
				
			||||||
, mpi
 | 
					 | 
				
			||||||
, autoreconfHook
 | 
					, autoreconfHook
 | 
				
			||||||
, gpi-2
 | 
					, gpi-2
 | 
				
			||||||
, boost
 | 
					, boost
 | 
				
			||||||
, numactl
 | 
					, numactl
 | 
				
			||||||
, rdma-core
 | 
					, rdma-core
 | 
				
			||||||
, gfortran
 | 
					, gfortran
 | 
				
			||||||
, symlinkJoin
 | 
					 | 
				
			||||||
}:
 | 
					}:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let
 | 
					 | 
				
			||||||
  mpiAll = symlinkJoin {
 | 
					 | 
				
			||||||
    name = "mpi-all";
 | 
					 | 
				
			||||||
    paths = [ mpi.all ];
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
in
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
stdenv.mkDerivation rec {
 | 
					stdenv.mkDerivation rec {
 | 
				
			||||||
  pname = "tagaspi";
 | 
					  pname = "tagaspi";
 | 
				
			||||||
  enableParallelBuilding = true;
 | 
					  enableParallelBuilding = true;
 | 
				
			||||||
@ -35,16 +26,18 @@ stdenv.mkDerivation rec {
 | 
				
			|||||||
    hash = "sha256-RGG/Re2uM293HduZfGzKUWioDtwnSYYdfeG9pVrX9EM=";
 | 
					    hash = "sha256-RGG/Re2uM293HduZfGzKUWioDtwnSYYdfeG9pVrX9EM=";
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  buildInputs = [
 | 
					  nativeBuildInputs = [
 | 
				
			||||||
    autoreconfHook
 | 
					    autoreconfHook
 | 
				
			||||||
    automake
 | 
					    automake
 | 
				
			||||||
    autoconf
 | 
					    autoconf
 | 
				
			||||||
    libtool
 | 
					    libtool
 | 
				
			||||||
 | 
					    gfortran
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  buildInputs = [
 | 
				
			||||||
    boost
 | 
					    boost
 | 
				
			||||||
    numactl
 | 
					    numactl
 | 
				
			||||||
    rdma-core
 | 
					    rdma-core
 | 
				
			||||||
    gfortran
 | 
					 | 
				
			||||||
    mpiAll
 | 
					 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  dontDisableStatic = true;
 | 
					  dontDisableStatic = true;
 | 
				
			||||||
@ -63,5 +56,6 @@ stdenv.mkDerivation rec {
 | 
				
			|||||||
    maintainers = with lib.maintainers.bsc; [ rarias ];
 | 
					    maintainers = with lib.maintainers.bsc; [ rarias ];
 | 
				
			||||||
    platforms = lib.platforms.linux;
 | 
					    platforms = lib.platforms.linux;
 | 
				
			||||||
    license = lib.licenses.gpl3Plus;
 | 
					    license = lib.licenses.gpl3Plus;
 | 
				
			||||||
 | 
					    cross = false; # gpi-2 cannot cross
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -68,5 +68,6 @@ in stdenv.mkDerivation {
 | 
				
			|||||||
    maintainers = with lib.maintainers.bsc; [ rarias ];
 | 
					    maintainers = with lib.maintainers.bsc; [ rarias ];
 | 
				
			||||||
    platforms = lib.platforms.linux;
 | 
					    platforms = lib.platforms.linux;
 | 
				
			||||||
    license = lib.licenses.gpl3Plus;
 | 
					    license = lib.licenses.gpl3Plus;
 | 
				
			||||||
 | 
					    cross = true;
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user