default.nix 3.14 KB
Newer Older
Valentin Reis's avatar
.  
Valentin Reis committed
1
{
Valentin Reis's avatar
Valentin Reis committed
2
  hostPkgs ? import <nixpkgs> {},
Valentin Reis's avatar
Valentin Reis committed
3 4
  pkgs         ? import ../pin.nix { inherit hostPkgs; jsonpath=../nixpkgs-18.03.json; },
  kapack       ? import ../pin.nix { hostPkgs = pkgs ; jsonpath=../kapack.json; depset = {hostPkgs=pkgs;};},
Valentin Reis's avatar
.  
Valentin Reis committed
5 6
}:
let
Valentin Reis's avatar
Valentin Reis committed
7
  gitpin = f: pkgs.fetchgit {inherit (pkgs.lib.importJSON f) url sha256 rev fetchSubmodules;};
Valentin Reis's avatar
Valentin Reis committed
8
  compiler_path = "/opt/intel/compilers_and_libraries_2017.1.132/linux";
Valentin Reis's avatar
.  
Valentin Reis committed
9
  callPackage = pkgs.lib.callPackageWith pkgs;
Valentin Reis's avatar
Valentin Reis committed
10
  callPackagePinWith =
Valentin Reis's avatar
Valentin Reis committed
11
  { folderPath
Valentin Reis's avatar
Valentin Reis committed
12 13
  , nixName ? "default"
  , jsonName ? nixName
Valentin Reis's avatar
Valentin Reis committed
14 15
  , depset ? {}
  } :
Valentin Reis's avatar
Valentin Reis committed
16
  let
Valentin Reis's avatar
Valentin Reis committed
17 18 19
    nixPath = folderPath + "/${nixName}.nix";
    jsonPath = folderPath + "/${jsonName}.json";
    src = gitpin jsonPath;
Valentin Reis's avatar
Valentin Reis committed
20
  in
Valentin Reis's avatar
Valentin Reis committed
21 22 23 24
  callPackage nixPath (depset // {inherit src;});

  cpDefaultPin = folderPath: depset: callPackagePinWith { inherit folderPath depset;};
  cpAlternatePin = folderPath: depset: jsonName: callPackagePinWith {inherit folderPath depset jsonName;};
Valentin Reis's avatar
Valentin Reis committed
25
  cpBothAlternatePin = folderPath: depset: jsonName: callPackagePinWith {inherit folderPath depset jsonName; nixName=jsonName;};
Valentin Reis's avatar
Valentin Reis committed
26
  pythonPackages = pkgs.python27Packages;
Valentin Reis's avatar
.  
Valentin Reis committed
27
in rec {
28
  #NRM components
Valentin Reis's avatar
Valentin Reis committed
29 30 31
  tools = rec {
    inherit (kapack) zymake;
  };
Valentin Reis's avatar
Valentin Reis committed
32

Valentin Reis's avatar
Valentin Reis committed
33
  nodelevel = rec {
Valentin Reis's avatar
Valentin Reis committed
34
    libnrm = cpDefaultPin ./libnrm {};
35 36
    libnrm-pmpi = libnrm.overrideAttrs (oldAttrs: rec {
      configureFlags = "--enable-pmpi";
37
      buildInputs = oldAttrs.buildInputs ++ [ pkgs.mpich2 ];
38
    });
Valentin Reis's avatar
Valentin Reis committed
39 40 41 42
    containers = cpDefaultPin ./containers { inherit pythonPackages; };
    containers-bandit = cpAlternatePin ./containers { inherit pythonPackages; } "bandit";
    nrm = cpDefaultPin ./nrm { inherit pythonPackages; nrm-containers = containers; };
    nrm-bandit = cpAlternatePin ./nrm { inherit pythonPackages; nrm-containers=containers-bandit; } "bandit";
43
  };
Valentin Reis's avatar
Valentin Reis committed
44

45
  #Instrumented applications
Valentin Reis's avatar
Valentin Reis committed
46 47
  applications =
  let
Valentin Reis's avatar
Valentin Reis committed
48 49
    paths = {
     amg = applications/amg;
Valentin Reis's avatar
Valentin Reis committed
50 51 52
     qmcpack = applications/qmcpack;
     openmc = applications/openmc;
     stream = applications/stream;
Valentin Reis's avatar
Valentin Reis committed
53 54
     lammps = applications/lammps;
    };
Valentin Reis's avatar
Valentin Reis committed
55 56 57 58 59
    rawApplication = name : path: cpDefaultPin path {};
    instrumentedApplication = name: path:
      (cpAlternatePin path {} "nrm").overrideAttrs (oldAttrs:
      {
        buildInputs = oldAttrs.buildInputs ++ [nodelevel.libnrm];
60
        cmakeFlags = if (name=="qmcpack") then
61
        (oldAttrs.cmakeFlags ++ [ ''-DQMC_INCLUDE=${nodelevel.libnrm}/include/'' ''-DQMC_EXTRA_LIBS=${nodelevel.libnrm}/lib/libnrm.so'' ])
62 63
        else
        [];
Valentin Reis's avatar
Valentin Reis committed
64 65 66
      });
  in
  rec {
67 68
    raw = pkgs.lib.mapAttrs rawApplication paths;
    nrm = (pkgs.lib.mapAttrs instrumentedApplication paths) // {
Valentin Reis's avatar
Valentin Reis committed
69 70 71
      dgemm_randomwalk = cpBothAlternatePin applications/simple {inherit intel; inherit (nodelevel) libnrm;} "dgemm_randomwalk";
      graph500 = cpBothAlternatePin applications/simple { inherit (nodelevel) libnrm;} "graph500";
    };
72
  };
Valentin Reis's avatar
Valentin Reis committed
73

74 75
  #Intel compilers
  intel = with pkgs; rec {
76 77
    icc = callPackage intel/icc { inherit compiler_path; };
    mkl = callPackage intel/mkl { inherit compiler_path; };
Valentin Reis's avatar
Valentin Reis committed
78
    WrappedICC = (import intel/cc-wrapper  {
Valentin Reis's avatar
Valentin Reis committed
79 80 81 82 83 84
        inherit stdenv binutils coreutils ;
        libc = glibc;
        nativeTools = false;
        nativeLibc = false;
        cc = icc;
    });
85
  };
Valentin Reis's avatar
renames  
Valentin Reis committed
86
}