2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv
|
2019-03-05 13:43:33 +00:00
|
|
|
, fetchzip
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, fftw
|
|
|
|
, fftwFloat
|
|
|
|
, enablePython ? false
|
2021-03-25 11:56:02 +00:00
|
|
|
, pythonPackages ? null
|
2019-03-05 13:43:33 +00:00
|
|
|
, 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";
|
2020-10-16 22:10:59 +00:00
|
|
|
version = "1.2.2";
|
2019-03-05 13:43:33 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mtazzari";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2020-10-16 22:10:59 +00:00
|
|
|
sha256 = "0dw88ga50x3jwyfgcarn4azlhiarggvdg262hilm7rbrvlpyvha0";
|
2019-03-05 13:43:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
buildInputs = [ fftw fftwFloat ]
|
2021-01-21 17:00:13 +00:00
|
|
|
++ lib.optional enablePython pythonPackages.python
|
|
|
|
++ lib.optional stdenv.isDarwin llvmPackages.openmp
|
2019-03-05 13:43:33 +00:00
|
|
|
;
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
propagatedBuildInputs = lib.optional enablePython [
|
2019-03-05 13:43:33 +00:00
|
|
|
pythonPackages.numpy
|
|
|
|
pythonPackages.cython
|
|
|
|
pythonPackages.pytest
|
|
|
|
];
|
|
|
|
|
2021-07-20 20:42:24 +00:00
|
|
|
checkInputs = lib.optional enablePython [ pythonPackages.scipy pythonPackages.pytest-cov ];
|
2019-03-05 13:43:33 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
postInstall = lib.optionalString (stdenv.isDarwin && enablePython) ''
|
2019-03-05 13:43:33 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2019-03-05 13:43:33 +00:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|