amd-libflame: init at 2.2

libflame is a protable library for dense matrix computations,
providing a complete LAPACK implementation. The AMD fork of libflame
is optimized for AMD CPUs.

+108
+34
pkgs/development/libraries/science/math/amd-libflame/add-lapacke.diff
···
··· 1 + diff --git a/Makefile b/Makefile 2 + index 5549ce30..ac2ee51e 100644 3 + --- a/Makefile 4 + +++ b/Makefile 5 + @@ -583,14 +583,14 @@ endif 6 + 7 + # --- Shared library linker rules --- 8 + 9 + -$(LIBFLAME_SO_PATH): $(MK_ALL_FLAMEC_OBJS) 10 + +$(LIBFLAME_SO_PATH): $(MK_ALL_FLAMEC_OBJS) $(LAPACKE_A_PATH) 11 + ifeq ($(ENABLE_VERBOSE),yes) 12 + ifeq ($(FLA_ENABLE_MAX_ARG_LIST_HACK),yes) 13 + $(CAT) $(AR_OBJ_LIST_FILE) | xargs -n$(AR_CHUNK_SIZE) $(AR) $(ARFLAGS) $(LIBFLAME_A) 14 + ifeq ($(OS_NAME),Darwin) 15 + - $(LINKER) $(SOFLAGS) -o $@ -Wl,-force_load,$(LIBFLAME_A) $(LDFLAGS) 16 + + $(LINKER) $(SOFLAGS) -o $@ -Wl,-force_load,$(LIBFLAME_A),$(LAPACKE_A_PATH) $(LDFLAGS) 17 + else 18 + - $(LINKER) $(SOFLAGS) -o $@ -Wl,--whole-archive,$(LIBFLAME_A),--no-whole-archive $(LDFLAGS) 19 + + $(LINKER) $(SOFLAGS) -o $@ -Wl,--whole-archive,$(LIBFLAME_A),$(LAPACKE_A_PATH)--no-whole-archive $(LDFLAGS) 20 + endif 21 + else 22 + # NOTE: Can't use $^ automatic variable as long as $(AR_OBJ_LIST_FILE) is in 23 + @@ -602,9 +602,9 @@ else 24 + ifeq ($(FLA_ENABLE_MAX_ARG_LIST_HACK),yes) 25 + @$(CAT) $(AR_OBJ_LIST_FILE) | xargs -n$(AR_CHUNK_SIZE) $(AR) $(ARFLAGS) $(LIBFLAME_A) 26 + ifeq ($(OS_NAME),Darwin) 27 + - @$(LINKER) $(SOFLAGS) -o $@ -Wl,-force_load,$(LIBFLAME_A) $(LDFLAGS) 28 + + @$(LINKER) $(SOFLAGS) -o $@ -Wl,-force_load,$(LIBFLAME_A),$(LAPACKE_A_PATH) $(LDFLAGS) 29 + else 30 + - @$(LINKER) $(SOFLAGS) -o $@ -Wl,--whole-archive,$(LIBFLAME_A),--no-whole-archive $(LDFLAGS) 31 + + @$(LINKER) $(SOFLAGS) -o $@ -Wl,--whole-archive,$(LIBFLAME_A),$(LAPACKE_A_PATH),--no-whole-archive $(LDFLAGS) 32 + endif 33 + else 34 + # NOTE: Can't use $^ automatic variable as long as $(AR_OBJ_LIST_FILE) is in
+72
pkgs/development/libraries/science/math/amd-libflame/default.nix
···
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , gfortran 5 + , python3 6 + , amd-blis 7 + 8 + , withOpenMP ? true 9 + }: 10 + 11 + stdenv.mkDerivation rec { 12 + pname = "amd-libflame"; 13 + version = "2.2"; 14 + 15 + src = fetchFromGitHub { 16 + owner = "amd"; 17 + repo = "libflame"; 18 + rev = version; 19 + sha256 = "1s8zvq6p843jb52lrbxra7vv0wzmifs4j36z9bp7wf3xr20a0zi5"; 20 + }; 21 + 22 + patches = [ 23 + # The LAPACKE interface is compiled as a separate static library, 24 + # we want the main dynamic library to provide LAPACKE symbols. 25 + # This patch adds lapacke.a to the shared library as well. 26 + ./add-lapacke.diff 27 + ]; 28 + 29 + nativeBuildInputs = [ gfortran python3 ]; 30 + 31 + buildInputs = [ amd-blis ]; 32 + 33 + configureFlags = [ 34 + # Build a dynamic library with a LAPACK interface. 35 + "--disable-static-build" 36 + "--enable-dynamic-build" 37 + "--enable-lapack2flame" 38 + 39 + # Use C BLAS interface. 40 + "--enable-cblas-interfaces" 41 + 42 + # Avoid overloading maximum number of arguments. 43 + "--enable-max-arg-list-hack" 44 + 45 + # libflame by default leaves BLAS symbols unresolved and leaves it 46 + # up to the application to explicitly link to a BLAS. This is 47 + # problematic for us, since then the BLAS library becomes an 48 + # implicit dependency. Moreover, since the point of the AMD forks 49 + # is to optimized for recent AMD CPUs, link against AMD BLIS. 50 + "LDFLAGS=-lcblas" 51 + ] 52 + ++ lib.optionals withOpenMP [ "--enable-multithreading=openmp" ]; 53 + 54 + enableParallelBuilding = true; 55 + 56 + postPatch = '' 57 + patchShebangs build 58 + ''; 59 + 60 + postInstall = '' 61 + ln -s $out/lib/libflame.so.${version} $out/lib/liblapack.so.3 62 + ln -s $out/lib/libflame.so.${version} $out/lib/liblapacke.so.3 63 + ''; 64 + 65 + meta = with stdenv.lib; { 66 + description = "LAPACK-compatible linear algebra library optimized for AMD CPUs"; 67 + homepage = "https://developer.amd.com/amd-aocl/blas-library/"; 68 + license = licenses.bsd3; 69 + maintainers = with maintainers; [ danieldk ]; 70 + platforms = [ "x86_64-linux" ]; 71 + }; 72 + }
+2
pkgs/top-level/all-packages.nix
··· 25307 25308 amd-blis = callPackage ../development/libraries/science/math/amd-blis { }; 25309 25310 arpack = callPackage ../development/libraries/science/math/arpack { }; 25311 25312 blas = callPackage ../build-support/alternatives/blas { };
··· 25307 25308 amd-blis = callPackage ../development/libraries/science/math/amd-blis { }; 25309 25310 + amd-libflame = callPackage ../development/libraries/science/math/amd-libflame { }; 25311 + 25312 arpack = callPackage ../development/libraries/science/math/arpack { }; 25313 25314 blas = callPackage ../build-support/alternatives/blas { };