default.nix 3.58 KB
Newer Older
Valentin Reis's avatar
.  
Valentin Reis committed
1
{
Valentin Reis's avatar
Valentin Reis committed
2 3
  hostPkgs        ? import <nixpkgs> {},
  system          ? builtins.currentSystem,
4
  pkgs            ? import ../pin.nix { inherit hostPkgs; jsonpath=../nixpkgs-unstable.json; depset = {inherit system;}; },
Valentin Reis's avatar
Valentin Reis committed
5
  kapack          ? import ../pin.nix { hostPkgs = pkgs ; jsonpath=../kapack.json; depset = {hostPkgs=pkgs;};},
6
 supportedSystems ? [ "x86_64-linux" "i686-linux" ]
Valentin Reis's avatar
.  
Valentin Reis committed
7 8
}:
let
9 10 11 12
  releaseTools = import "${pkgs}/top-level/release-lib.nix" {
    inherit supportedSystems;
  };

Valentin Reis's avatar
Valentin Reis committed
13
  gitpin = f: pkgs.fetchgit {inherit (pkgs.lib.importJSON f) url sha256 rev fetchSubmodules;};
Valentin Reis's avatar
Valentin Reis committed
14
  compiler_path = "/opt/intel/compilers_and_libraries_2017.1.132/linux";
Valentin Reis's avatar
Valentin Reis committed
15
  callPackage = pkgs.lib.callPackageWith (pkgs//argopkgs);
Valentin Reis's avatar
Valentin Reis committed
16
  callPackagePinWith =
Valentin Reis's avatar
Valentin Reis committed
17
  { folderPath
Valentin Reis's avatar
Valentin Reis committed
18 19
  , nixName ? "default"
  , jsonName ? nixName
Valentin Reis's avatar
Valentin Reis committed
20 21
  , depset ? {}
  } :
Valentin Reis's avatar
Valentin Reis committed
22
  let
Valentin Reis's avatar
Valentin Reis committed
23 24 25
    nixPath = folderPath + "/${nixName}.nix";
    jsonPath = folderPath + "/${jsonName}.json";
    src = gitpin jsonPath;
Valentin Reis's avatar
Valentin Reis committed
26
  in
Valentin Reis's avatar
Valentin Reis committed
27 28 29 30
  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
31
  cpBothAlternatePin = folderPath: depset: jsonName: callPackagePinWith {inherit folderPath depset jsonName; nixName=jsonName;};
Valentin Reis's avatar
Valentin Reis committed
32
  pythonPackages = pkgs.python27Packages;
33

34
  argopkgs = rec {
35
    #pyzmq = pythonPackages.pyzmq.override { zeromq3 = pkgs.zeromq; };
Valentin Reis's avatar
Valentin Reis committed
36

37 38 39 40
    #NRM components
    tools = rec {
      inherit (kapack) zymake;
    };
Valentin Reis's avatar
Valentin Reis committed
41

42 43 44 45 46 47
    nodelevel = rec {
      libnrm = cpDefaultPin ./libnrm {};
      libnrm-pmpi = libnrm.overrideAttrs (oldAttrs: rec {
        configureFlags = "--enable-pmpi";
        buildInputs = oldAttrs.buildInputs ++ [ pkgs.mpich2 ];
      });
48
      containers = cpDefaultPin ./containers { inherit pythonPackages; };
49
      containers-bandit = cpAlternatePin ./containers { inherit pythonPackages; } "bandit";
50
      nrm = cpDefaultPin ./nrm { inherit pythonPackages; nrm-containers = containers; };
51 52
      nrm-bandit = cpAlternatePin ./nrm { inherit pythonPackages; nrm-containers=containers-bandit; } "bandit";
    };
Valentin Reis's avatar
Valentin Reis committed
53

54 55 56 57 58
    #Instrumented applications
    applications =
    let
      paths = {
       amg = applications/amg;
Valentin Reis's avatar
Valentin Reis committed
59
       #qmcpack = applications/qmcpack;
Valentin Reis's avatar
Valentin Reis committed
60
       #openmc = applications/openmc;
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
       stream = applications/stream;
       lammps = applications/lammps;
      };
      rawApplication = name : path: cpDefaultPin path {};
      instrumentedApplication = name: path:
        (cpAlternatePin path {} "nrm").overrideAttrs (oldAttrs:
        {
          buildInputs = oldAttrs.buildInputs ++ [nodelevel.libnrm];
          cmakeFlags = if (name=="qmcpack") then
          (oldAttrs.cmakeFlags ++ [ ''-DQMC_INCLUDE=${nodelevel.libnrm}/include/'' ''-DQMC_EXTRA_LIBS=${nodelevel.libnrm}/lib/libnrm.so'' ])
          else
          [];
        });
    in
    rec {
      raw = pkgs.lib.mapAttrs rawApplication paths;
      nrm = (pkgs.lib.mapAttrs instrumentedApplication paths) // {
78
        dgemm_randomwalk = cpBothAlternatePin applications/simple { inherit (nodelevel) libnrm;} "dgemm_randomwalk";
79 80
        graph500 = cpBothAlternatePin applications/simple { inherit (nodelevel) libnrm;} "graph500";
      };
Valentin Reis's avatar
Valentin Reis committed
81
    };
82 83 84 85 86 87 88 89 90 91 92

    #Intel compilers
    intel = with pkgs; rec {
      icc = callPackage intel/icc { inherit compiler_path; };
      mkl = callPackage intel/mkl { inherit compiler_path; };
      WrappedICC = (import intel/cc-wrapper  {
          inherit stdenv binutils coreutils ;
          libc = glibc;
          nativeTools = false;
          nativeLibc = false;
          cc = icc;
Valentin Reis's avatar
Valentin Reis committed
93
      });
Valentin Reis's avatar
Valentin Reis committed
94
    };
95
  };
96

Valentin Reis's avatar
Valentin Reis committed
97
in argopkgs // pkgs