summary refs log tree commit diff
diff options
context:
space:
mode:
authorSébastien Maret <sebastien.maret@icloud.com>2019-03-05 14:43:33 +0100
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2020-02-09 10:21:30 +0100
commit4ea8f051ac2bf8edfdc5e712191fb6e34212a95b (patch)
treee799433dd789ec2431f0248fe5c849a5e28ef0c1
parentca44e9514cf8689915c20627ce4a085a0bc3fb4a (diff)
downloadnixpkgs-4ea8f051ac2bf8edfdc5e712191fb6e34212a95b.tar
nixpkgs-4ea8f051ac2bf8edfdc5e712191fb6e34212a95b.tar.gz
nixpkgs-4ea8f051ac2bf8edfdc5e712191fb6e34212a95b.tar.bz2
nixpkgs-4ea8f051ac2bf8edfdc5e712191fb6e34212a95b.tar.lz
nixpkgs-4ea8f051ac2bf8edfdc5e712191fb6e34212a95b.tar.xz
nixpkgs-4ea8f051ac2bf8edfdc5e712191fb6e34212a95b.tar.zst
nixpkgs-4ea8f051ac2bf8edfdc5e712191fb6e34212a95b.zip
galario: init at 1.2.1
Co-Authored-By: Daniel Schaefer <git@danielschaefer.me>
-rw-r--r--pkgs/development/libraries/galario/default.nix78
-rw-r--r--pkgs/top-level/all-packages.nix2
-rw-r--r--pkgs/top-level/python-packages.nix5
3 files changed, 85 insertions, 0 deletions
diff --git a/pkgs/development/libraries/galario/default.nix b/pkgs/development/libraries/galario/default.nix
new file mode 100644
index 00000000000..08450e56983
--- /dev/null
+++ b/pkgs/development/libraries/galario/default.nix
@@ -0,0 +1,78 @@
+{ stdenv
+, fetchzip
+, fetchFromGitHub
+, cmake
+, fftw
+, fftwFloat
+, enablePython ? false
+, pythonPackages
+, llvmPackages
+}:
+let
+  # CMake recipes are needed to build galario
+  # Build process would usually download them
+  great-cmake-cookoff = fetchzip {
+    url = "https://github.com/UCL/GreatCMakeCookOff/archive/v2.1.9.tar.gz";
+    sha256 = "1yd53b5gx38g6f44jmjk4lc4igs3p25z6616hfb7aq79ly01q0w2";
+  };
+in
+stdenv.mkDerivation rec {
+  pname = "galario";
+  version = "1.2.1";
+
+  src = fetchFromGitHub {
+    owner = "mtazzari";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1akz7md7ly16a89zr880c265habakqdg9sj8iil90klqa0i21w6g";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ fftw fftwFloat ]
+    ++ stdenv.lib.optional enablePython pythonPackages.python
+    ++ stdenv.lib.optional stdenv.isDarwin llvmPackages.openmp
+  ;
+
+  propagatedBuildInputs = stdenv.lib.optional enablePython [
+    pythonPackages.numpy
+    pythonPackages.cython
+    pythonPackages.pytest
+  ];
+
+  checkInputs = stdenv.lib.optional enablePython pythonPackages.scipy;
+
+  preConfigure = ''
+    mkdir -p build/external/src
+    cp -r ${great-cmake-cookoff} build/external/src/GreatCMakeCookOff
+    chmod -R 777 build/external/src/GreatCMakeCookOff
+  '';
+
+  preCheck = ''
+    ${if stdenv.isDarwin then "export DYLD_LIBRARY_PATH=$(pwd)/src/" else "export LD_LIBRARY_PATH=$(pwd)/src/"}
+    ${if enablePython then "sed -i -e 's|^#!.*|#!${stdenv.shell}|' python/py.test.sh" else ""}
+  '';
+
+  doCheck = true;
+
+  postInstall = stdenv.lib.optionalString (stdenv.isDarwin && enablePython) ''
+    install_name_tool -change libgalario.dylib $out/lib/libgalario.dylib $out/lib/python*/site-packages/galario/double/libcommon.so
+    install_name_tool -change libgalario_single.dylib $out/lib/libgalario_single.dylib $out/lib/python*/site-packages/galario/single/libcommon.so
+  '';
+
+  meta = with stdenv.lib; {
+    description = "GPU Accelerated Library for Analysing Radio Interferometer Observations";
+    longDescription = ''
+      Galario is a library that exploits the computing power of modern
+      graphic cards (GPUs) to accelerate the comparison of model
+      predictions to radio interferometer observations. Namely, it
+      speeds up the computation of the synthetic visibilities given a
+      model image (or an axisymmetric brightness profile) and their
+      comparison to the observations.
+    '';
+    homepage = "https://mtazzari.github.io/galario/";
+    license = licenses.lgpl3;
+    maintainers = [ maintainers.smaret ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 62ddc0820da..98b11fb4775 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -24519,6 +24519,8 @@ in
 
   fityk = callPackage ../applications/science/misc/fityk { };
 
+  galario = callPackage ../development/libraries/galario { };
+
   gildas = callPackage ../applications/science/astronomy/gildas { };
 
   gplates = callPackage ../applications/science/misc/gplates {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 6dc9f39238f..975df9f16b9 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -3601,6 +3601,11 @@ in {
 
   futures = callPackage ../development/python-modules/futures { };
 
+  galario = toPythonModule (pkgs.galario.override {
+    enablePython = true;
+    pythonPackages = self;
+  });
+
   gcovr = callPackage ../development/python-modules/gcovr { };
 
   gdal = toPythonModule (pkgs.gdal.override {