forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
petsc: added features, especially mpi support
- Loading branch information
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ stdenv | ||
, fetchurl | ||
, openblasCompat | ||
, python | ||
, gfortran | ||
, openmpi | ||
, tcsh | ||
, valgrind | ||
, suitesparse | ||
, hwloc | ||
, metis | ||
, superlu | ||
, hdf5 | ||
, netcdf | ||
, scalarType ? "complex" # May be "real" or "complex" | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
name = "petsc-${version}"; | ||
version = "3.7.6"; | ||
|
||
src = fetchurl { | ||
url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-${version}.tar.gz"; | ||
sha256 = "0jfl35lrhzvv982z6h1v5rcp39g0x16ca43rm9dx91wm6i8y13iw"; | ||
}; | ||
|
||
patches = [ ./petscmpiexec.patch ]; | ||
|
||
buildInputs = [ | ||
openblasCompat | ||
python | ||
gfortran | ||
openmpi | ||
tcsh | ||
valgrind | ||
suitesparse | ||
hwloc | ||
metis | ||
superlu | ||
hdf5 | ||
netcdf | ||
]; | ||
|
||
enableParallelBuilding = true; | ||
|
||
preConfigure = '' | ||
patchShebangs . | ||
''; | ||
|
||
configureFlags = let | ||
sharedLibraryExtension = if stdenv.isDarwin then ".dylib" else ".so"; | ||
in [ | ||
"--with-scalar-type=${scalarType}" | ||
"--with-debugging=0" | ||
"--with-mpi=1" | ||
# PETSc is not threadsafe, disable pthread/openmp (see http://www.mcs.anl.gov/petsc/miscellaneous/petscthreads.html) | ||
"--with-pthread=0" | ||
"--with-openmp=0" | ||
"--with-ssl=0" | ||
"--with-x=0" | ||
"--with-mpi-dir=${openmpi}" | ||
"--with-blas-lapack-lib=${openblasCompat}/lib/libopenblas${sharedLibraryExtension}" | ||
"--with-valgrind=1" | ||
"--with-valgrind-dir=${valgrind}" | ||
"--with-suitesparse-dir=${suitesparse}" | ||
"--with-hwloc-dir=${hwloc}" | ||
"--with-netcdf-dir=${netcdf}" | ||
"--with-hdf5-dir=${hdf5}" | ||
"--with-superlu-dir=${superlu}" | ||
"--with-metis-dir=${metis}" | ||
]; | ||
|
||
postInstall = '' | ||
rm $out/bin/popup | ||
rm $out/bin/uncrustify.cfg | ||
rm -rf $out/bin/win32fe | ||
''; | ||
|
||
doCheck = true; | ||
|
||
meta = { | ||
description = "Library of linear algebra algorithms for solving partial differential equations"; | ||
homepage = https://www.mcs.anl.gov/petsc/index.html; | ||
platforms = stdenv.lib.platforms.all; | ||
license = stdenv.lib.licenses.bsd2; | ||
}; | ||
} |
24 changes: 24 additions & 0 deletions
24
pkgs/development/libraries/science/math/petsc/petscmpiexec.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff -r -u petsc-3.7.6.orig/bin/petscmpiexec petsc-3.7.6/bin/petscmpiexec | ||
--- petsc-3.7.6.orig/bin/petscmpiexec 2016-05-16 04:57:35.000000000 +0200 | ||
+++ petsc-3.7.6/bin/petscmpiexec 2017-09-08 10:20:15.766763209 +0200 | ||
@@ -1,4 +1,4 @@ | ||
-#! /bin/csh -f | ||
+#!/bin/tcsh -f | ||
# $Id: petscmpiexec,v 1.3 2001/09/04 16:18:05 bsmith Exp $ | ||
# | ||
# Uses PETSC_ARCH and PETSC_DIR plus the MPIEXEC command in | ||
@@ -38,11 +38,11 @@ | ||
#echo $MPI_HOME | ||
|
||
#echo $run | ||
-set trun = `echo ${run} | sed -e sz\$MPI_BUILD_HOMEz${MPI_BUILD_HOME}z` | ||
+set trun = `echo ${run} | sed -e s,\$MPI_BUILD_HOME,${MPI_BUILD_HOME},` | ||
#echo $trun | ||
-set nrun = `echo ${trun} | sed -e sz\$MPI_HOMEz${MPI_HOME}z` | ||
+set nrun = `echo ${trun} | sed -e s,\$MPI_HOME,${MPI_HOME},` | ||
#echo $nrun | ||
-set qrun = `echo ${nrun} | sed -e sz\$PETSC_DIRz${PETSC_DIR}z` | ||
+set qrun = `echo ${nrun} | sed -e s,\$PETSC_DIR,${PETSC_DIR},` | ||
#echo $qrun | ||
|
||
#echo $qrun $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters