* [bug#28045] [PATCH] gnu: Add openfoam @ 2017-08-11 11:06 ` Paul Garlick 2017-08-14 23:07 ` Marius Bakke ` (2 more replies) 0 siblings, 3 replies; 22+ messages in thread From: Paul Garlick @ 2017-08-11 11:06 UTC (permalink / raw) To: 28045; +Cc: Paul Garlick * gnu/packages/simulation.scm: New file * gnu/packages/patches/openfoam-cleanup.patch: New file * gnu/local.mk(GNU_SYSTEM_MODULES): Add module (dist_patch_DATA): Add patch --- gnu/local.mk | 2 + gnu/packages/patches/openfoam-cleanup.patch | 251 ++++++++++++++++++++++++++++ gnu/packages/simulation.scm | 197 ++++++++++++++++++++++ 3 files changed, 450 insertions(+) create mode 100644 gnu/packages/patches/openfoam-cleanup.patch create mode 100644 gnu/packages/simulation.scm diff --git a/gnu/local.mk b/gnu/local.mk index 4b2bdfe37..b00ec1ac7 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -357,6 +357,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/shells.scm \ %D%/packages/shellutils.scm \ %D%/packages/simh.scm \ + %D%/packages/simulation.scm \ %D%/packages/skarnet.scm \ %D%/packages/skribilo.scm \ %D%/packages/slang.scm \ @@ -866,6 +867,7 @@ dist_patch_DATA = \ %D%/packages/patches/ola-readdir-r.patch \ %D%/packages/patches/openscenegraph-ffmpeg3.patch \ %D%/packages/patches/openexr-missing-samples.patch \ + %D%/packages/patches/openfoam-cleanup.patch \ %D%/packages/patches/openjpeg-CVE-2016-9850-CVE-2016-9851.patch \ %D%/packages/patches/openjpeg-CVE-2016-9572-CVE-2016-9573.patch \ %D%/packages/patches/openldap-CVE-2017-9287.patch \ diff --git a/gnu/packages/patches/openfoam-cleanup.patch b/gnu/packages/patches/openfoam-cleanup.patch new file mode 100644 index 000000000..b2c0ddcd1 --- /dev/null +++ b/gnu/packages/patches/openfoam-cleanup.patch @@ -0,0 +1,251 @@ +# This patch removes all need for the ThirdParty files of OpenFOAM + +# Derived from easybuild patch: Ward Poelmans <wpoely86@gmail.com> +# Modified for GNU Guix: Paul Garlick <pgarlick@tourbillion-technology.com> + +diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake +--- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake ++++ OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake +@@ -9,7 +9,7 @@ + # + # use readline if available + # +-if [ -f /usr/include/readline/readline.h ] ++if true + then + echo "Found <readline/readline.h> -- enabling readline support." + export COMP_FLAGS="-DHAS_READLINE" +diff -ur OpenFOAM-4.x-version-4.1.org/etc/bashrc OpenFOAM-4.x-version-4.1/etc/bashrc +--- OpenFOAM-4.x-version-4.1.org/etc/bashrc ++++ OpenFOAM-4.x-version-4.1/etc/bashrc +@@ -43,8 +43,10 @@ + # Please set to the appropriate path if the default is not correct. + # + [ $BASH_SOURCE ] && \ +-export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \ ++export FOAM_INST_DIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) || \ + export FOAM_INST_DIR=$HOME/$WM_PROJECT ++# For GNU Guix: set initially for build then re-set at runtime ++# + # export FOAM_INST_DIR=~$WM_PROJECT + # export FOAM_INST_DIR=/opt/$WM_PROJECT + # export FOAM_INST_DIR=/usr/local/$WM_PROJECT +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL +@@ -36,37 +36,7 @@ + # + #------------------------------------------------------------------------------ + +-boost_version=boost-system +-cgal_version=cgal-system +-#cgal_version=CGAL-4.8 +- +-if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ] +-then +- +- common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER +- +- export BOOST_ARCH_PATH=$common_path/$boost_version +- export CGAL_ARCH_PATH=$common_path/$cgal_version +- +- if [ "$FOAM_VERBOSE" -a "$PS1" ] +- then +- echo "Using CGAL and boost" 1>&2 +- echo " $cgal_version at $CGAL_ARCH_PATH" 1>&2 +- echo " $boost_version at $BOOST_ARCH_PATH" 1>&2 +- fi +- +- if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ] +- then +- _foamAddLib $CGAL_ARCH_PATH/lib +- fi +- +- if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ] +- then +- _foamAddLib $BOOST_ARCH_PATH/lib +- fi +- +- unset boost_version cgal_version common_path +- +-fi ++export CGAL_ARCH_PATH=$CGAL_ROOT ++export BOOST_ARCH_PATH=$BOOST_ROOT + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools 2016-10-16 16:11:45.000000000 +0200 ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools 2017-04-10 14:51:01.473221230 +0200 +@@ -29,13 +29,13 @@ + # + #------------------------------------------------------------------------------ + +-version=svn +-gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER +- +-GPERFTOOLS_VERSION=gperftools-$version +-GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION +- +-export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH +-export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH ++# version=svn ++# gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER ++# ++# GPERFTOOLS_VERSION=gperftools-$version ++# GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION ++# ++# export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH ++# export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-version-4.1/etc/config.sh/metis +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/metis +@@ -34,7 +34,7 @@ + # + #------------------------------------------------------------------------------ + +-export METIS_VERSION=metis-5.1.0 +-export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION ++export METIS_VERSION=metis-$METISVERSION ++export METIS_ARCH_PATH=$METIS_ROOT + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch OpenFOAM-4.x-version-4.1/etc/config.sh/scotch +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/scotch +@@ -37,7 +37,7 @@ + # + #------------------------------------------------------------------------------ + +-export SCOTCH_VERSION=scotch_6.0.3 +-export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION ++export SCOTCH_VERSION=scotch_$SCOTCHVERSION ++export SCOTCH_ARCH_PATH=$SCOTCH_ROOT + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings OpenFOAM-4.x-version-4.1/etc/config.sh/settings +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/settings +@@ -279,6 +279,9 @@ + ;; + system) + # Use system compiler ++ # Use system GMP and MPFR packages ++ export GMP_ARCH_PATH=$GMP_ROOT ++ export MPFR_ARCH_PATH=$MPFR_ROOT + ;; + *) + echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2 +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options +@@ -5,8 +5,7 @@ + $(PFLAGS) $(PINC) \ + -I$(SCOTCH_ROOT)/include \ + -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \ +- -I/usr/include/scotch \ + -I../decompositionMethods/lnInclude + + LIB_LIBS = \ +- -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt ++ -L$(SCOTCH_ROOT)/lib -L$(MPI_ARCH_PATH)/lib -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options +@@ -9,8 +9,7 @@ + $(PFLAGS) $(PINC) \ + -I$(SCOTCH_ROOT)/include \ + -I$(SCOTCH_ARCH_PATH)/include \ +- -I/usr/include/scotch \ + -I../decompositionMethods/lnInclude + + LIB_LIBS = \ +- -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt ++ -L$(SCOTCH_ROOT)/lib -lscotch -lscotcherrexit -lrt +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/src/Makefile OpenFOAM-4.x-version-4.1/wmake/src/Makefile +--- OpenFOAM-4.x-version-4.1.org/wmake/src/Makefile ++++ OpenFOAM-4.x-version-4.1/wmake/src/Makefile +@@ -33,7 +33,7 @@ + # The Makefile use a POSIX shell + #------------------------------------------------------------------------------ + +-SHELL = /bin/sh ++# SHELL = /bin/sh + + #------------------------------------------------------------------------------ + # Unset suffices list (suffix rules are not used) +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general +--- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general ++++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general +@@ -33,7 +33,7 @@ + # The Makefile uses a POSIX shell + #------------------------------------------------------------------------------ + +-SHELL = /bin/sh ++# SHELL = /bin/sh + + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmake OpenFOAM-4.x-version-4.1/wmake/wmake +--- OpenFOAM-4.x-version-4.1.org/wmake/wmake ++++ OpenFOAM-4.x-version-4.1/wmake/wmake +@@ -163,7 +163,7 @@ + then + if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ] + then +- lockDir=$HOME/.$WM_PROJECT/.wmake ++ lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake + + if [ -d $lockDir ] + then +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler +--- OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler ++++ OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler +@@ -53,7 +53,7 @@ + # csh sets HOST, bash sets HOSTNAME + : ${HOST:=$HOSTNAME} + +-lockDir=$HOME/.$WM_PROJECT/.wmake ++lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake + + # Fallback - 1 core on current host + : ${WM_HOSTS:=$HOST:1} +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime +--- OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime ++++ OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime +@@ -53,7 +53,7 @@ + # csh sets HOST, bash sets HOSTNAME + : ${HOST:=$HOSTNAME} + +-lockDir=$HOME/.$WM_PROJECT/.wmake ++lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake + # Fallback - 1 core on current host + : ${WM_HOSTS:=$HOST:1} + +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C +@@ -67,7 +67,7 @@ + + // Processor weights initialised with no size, only used if specified in + // a file +- Field<scalar> processorWeights; ++ Field<floatScalar> processorWeights; + + // Cell weights (so on the vertices of the dual) + List<label> cellWeights; +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL +--- OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL ++++ OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL +@@ -6,8 +6,8 @@ + -I/usr/include + + CGAL_LIBS = \ +- -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ +- -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ ++ -L$(MPFR_ARCH_PATH)/lib \ ++ -L$(GMP_ARCH_PATH)/lib \ + -L$(BOOST_ARCH_PATH)/lib \ + -L$(CGAL_ARCH_PATH)/lib \ + -lCGAL \ diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm new file mode 100644 index 000000000..5aa5f8f03 --- /dev/null +++ b/gnu/packages/simulation.scm @@ -0,0 +1,197 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com> +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. + +(define-module (gnu packages simulation) + #:use-module (gnu packages) + #:use-module (gnu packages base) + #:use-module (gnu packages bash) + #:use-module (gnu packages bison) + #:use-module (gnu packages boost) + #:use-module (gnu packages compression) + #:use-module (gnu packages flex) + #:use-module (gnu packages gettext) + #:use-module (gnu packages gcc) + #:use-module (gnu packages gl) + #:use-module (gnu packages graphics) + #:use-module (gnu packages gtk) + #:use-module (gnu packages linux) + #:use-module (gnu packages m4) + #:use-module (gnu packages maths) + #:use-module (gnu packages mpi) + #:use-module (gnu packages multiprecision) + #:use-module (gnu packages ncurses) + #:use-module (gnu packages readline) + #:use-module (gnu packages tls) + #:use-module (gnu packages version-control) + #:use-module (gnu packages xml) + #:use-module (gnu packages xorg) + #:use-module (guix download) + #:use-module (guix build utils) + #:use-module (guix build-system gnu) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (ice-9 ftw) + #:use-module (ice-9 regex) + #:use-module (srfi srfi-1)) + +(define-public openfoam + (package + (name "openfoam") + (version "4.1") + (source + (origin + (method url-fetch) + (uri (string-append + "http://dl.openfoam.org/source/" + (string-replace-substring version "." "-"))) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 "1hgh2kw7fqv4bfachhbjhw16v8j35jbv6s576fmz4ka2q4ks4wg3")) + (patches (search-patches "openfoam-cleanup.patch")) + (modules '((guix build utils))))) + (build-system gnu-build-system) + (native-inputs + `(("bison" ,bison))) + (propagated-inputs + `(("boost" ,boost) + ("cgal" ,cgal) + ("flex" ,flex) + ("git" ,git) + ("gmp" ,gmp) + ("gzip" ,gzip) + ("gnuplot" ,gnuplot) + ("libxt" ,libxt) + ("metis" ,metis) + ("mpfr" ,mpfr) + ("ncurses" ,ncurses) + ("openmpi" ,openmpi) + ("readline" ,readline) + ("scotch" ,pt-scotch) + ("zlib" ,zlib))) + (arguments + `(;; executable files and shared libraries are located in the 'platforms' + ;; subdirectory + #:strip-directories (list (string-append + "OpenFOAM-" ,version + "/platforms/linux64GccDPInt32Opt/bin") + (string-append + "OpenFOAM-" ,version + "/platforms/linux64GccDPInt32Opt/lib")) + ;; '#:elf-directories' is not recognised here so skip validation phase + #:validate-runpath? #f + #:phases (modify-phases %standard-phases + (add-after 'unpack 'rename-build-directory + (lambda _ + (use-modules (ice-9 ftw)) + (use-modules (ice-9 regex)) + (chdir "..") + ;; use 'OpenFOAM-version' convention to match path name + ;; expectations in the build phase + (let ((unpack-dir (string-append + (getcwd) "/" + (list-ref (scandir (getcwd) (lambda (name) + (string-match "^OpenFOAM" name))) 0))) + (build-dir (string-append + (getcwd) "/OpenFOAM-" ,version))) + ;; re-name build directory + (rename-file unpack-dir build-dir) + ;; move to build directory + (chdir (basename build-dir))))) + (add-after 'patch-source-shebangs 'set-environment-variables + (lambda _ + (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch"))) + ;; set variables to define store paths + (for-each (lambda (library) + (setenv (string-append + (string-upcase library) "_ROOT") + (assoc-ref %build-inputs library))) libraries)) + ;; set variables to define package versions + (setenv "SCOTCHVERSION" ,(package-version scotch)) + (setenv "METISVERSION" ,(package-version metis)))) + (delete 'configure) ; no configure phase + (delete 'patch-generated-file-shebangs) ; no generated files + (replace 'build + (lambda _ + ;; compile OpenFOAM libraries and applications + (zero? (system (format #f + "source ./etc/bashrc && ./Allwmake -j~a" + (parallel-job-count)))))) + (add-after 'build 'update-configuration-files + (lambda _ + ;; record store paths and package versions in configuration files + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" + "$CGAL_ROOT" "etc/config.sh/CGAL"))) + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" + "$BOOST_ROOT" "etc/config.sh/CGAL"))) + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" + "$METIS_ROOT" "etc/config.sh/metis"))) + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" + "$METISVERSION" "etc/config.sh/metis"))) + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" + "$SCOTCH_ROOT" "etc/config.sh/scotch"))) + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" + "$SCOTCHVERSION" "etc/config.sh/scotch"))) + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" + "$GMP_ROOT" "etc/config.sh/settings"))) + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" + "$MPFR_ROOT" "etc/config.sh/settings"))))) + (delete 'check) ; no tests to run + (replace 'install + (lambda _ + ;; use 'OpenFOAM-version' convention + (let ((install-dir (string-append + %output "/OpenFOAM-" ,version))) + ;; create install directory + (mkdir-p install-dir) + ;; move contents of build directory to install directory + (copy-recursively "." install-dir))))))) + ;; Note: tutorial files are installed read-only in /gnu/store. + ;; To allow write permissions on files copied from the store a + ;; 'chmod' step is needed before running the applications. For + ;; example, from a user's login: + ;; $ source $GUIX_PROFILE/OpenFOAM-4.1/etc/bashrc + ;; $ mkdir -p $FOAM_RUN + ;; $ cd $FOAM_RUN + ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzdaily . + ;; $ cd pitzdaily + ;; $ chmod -R u+w . + ;; $ blockMesh + (native-search-paths + ;; define the FOAM_INST_DIR variable + (list (search-path-specification + (variable "FOAM_INST_DIR") + (files '("."))))) + (synopsis "Framework for numerical simulation of fluid flow") + (description "OpenFOAM provides a set of solvers and methods for tackling +problems in the field of Computational Fluid Dynamics (CFD). It is written in +C++. Complex governing equations such as the Navier-Stokes equations can be +solved in integral form. Physical processes such as phase change, droplet +transport and chemical reaction can be modelled. Numerical methods are +included to deal with sharp gradients, such as those encountered in flows with +shock waves and flows with gas/liquid interfaces. + +OpenFOAM implements the Finite Volume Method for discretizing the spacial +dimensions. Computational grids defining geometries in two- and +three-dimensional domains may be generated by the included blockMesh and +snappyHexMesh routines or imported from external grid-generation packages. +Grids may be unstructured in layout and may contain any combination of +polyhedral cells. Large problems may be split into smaller, connected +problems for efficient solution on parallel systems") + (license license:gpl3+) + (home-page "https://openfoam.org"))) -- 2.13.0 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-08-11 11:06 ` [bug#28045] [PATCH] gnu: Add openfoam Paul Garlick @ 2017-08-14 23:07 ` Marius Bakke 2017-08-15 2:49 ` Eric Bavier 2017-09-07 22:41 ` [bug#28045] [PATCH] gnu: Add openfoam] Paul Garlick 2 siblings, 0 replies; 22+ messages in thread From: Marius Bakke @ 2017-08-14 23:07 UTC (permalink / raw) To: Paul Garlick, 28045 [-- Attachment #1: Type: text/plain, Size: 15473 bytes --] Paul Garlick <pgarlick@tourbillion-technology.com> writes: > * gnu/packages/simulation.scm: New file > * gnu/packages/patches/openfoam-cleanup.patch: New file > * gnu/local.mk(GNU_SYSTEM_MODULES): Add module > (dist_patch_DATA): Add patch Thanks a lot for this! The patch does not apply for me, can you rebase this on current 'master'? Meanwhile, some comments... > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/src/Makefile OpenFOAM-4.x-version-4.1/wmake/src/Makefile > +--- OpenFOAM-4.x-version-4.1.org/wmake/src/Makefile > ++++ OpenFOAM-4.x-version-4.1/wmake/src/Makefile > +@@ -33,7 +33,7 @@ > + # The Makefile use a POSIX shell > + #------------------------------------------------------------------------------ > + > +-SHELL = /bin/sh > ++# SHELL = /bin/sh This particular hunk is not necessary since gnu-build-system will search for Makefiles and adjust SHELL as needed. > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general > +--- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general > ++++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general > +@@ -33,7 +33,7 @@ > + # The Makefile uses a POSIX shell > + #------------------------------------------------------------------------------ > + > +-SHELL = /bin/sh > ++# SHELL = /bin/sh ...although this file named "general" would not be patched automatically. > + #------------------------------------------------------------------------------ > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmake OpenFOAM-4.x-version-4.1/wmake/wmake > +--- OpenFOAM-4.x-version-4.1.org/wmake/wmake > ++++ OpenFOAM-4.x-version-4.1/wmake/wmake > +@@ -163,7 +163,7 @@ > + then > + if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ] > + then > +- lockDir=$HOME/.$WM_PROJECT/.wmake > ++ lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake > + > + if [ -d $lockDir ] > + then > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler > +--- OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler > ++++ OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler > +@@ -53,7 +53,7 @@ > + # csh sets HOST, bash sets HOSTNAME > + : ${HOST:=$HOSTNAME} > + > +-lockDir=$HOME/.$WM_PROJECT/.wmake > ++lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake > + > + # Fallback - 1 core on current host > + : ${WM_HOSTS:=$HOST:1} > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime > +--- OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime > ++++ OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime > +@@ -53,7 +53,7 @@ > + # csh sets HOST, bash sets HOSTNAME > + : ${HOST:=$HOSTNAME} > + > +-lockDir=$HOME/.$WM_PROJECT/.wmake > ++lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake > + # Fallback - 1 core on current host > + : ${WM_HOSTS:=$HOST:1} Maybe these could be replaced with something like... (substitute* (find-files "." "^\\.wmake$") (("\\$HOME) (getenv "PWD"))) $PWD is initially the source directory, which I think is what the $(dirname $BASH_SOURCE ...) is aiming for(?). > +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C > +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C > ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C > +@@ -67,7 +67,7 @@ > + > + // Processor weights initialised with no size, only used if specified in > + // a file > +- Field<scalar> processorWeights; > ++ Field<floatScalar> processorWeights; This seems unrelated to unbundling :) Is this a known issue? > diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm > new file mode 100644 > index 000000000..5aa5f8f03 > --- /dev/null > +++ b/gnu/packages/simulation.scm > @@ -0,0 +1,197 @@ > +;;; GNU Guix --- Functional package management for GNU > +;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com> > +;;; > +;;; This file is part of GNU Guix. > +;;; > +;;; GNU Guix is free software; you can redistribute it and/or modify it > +;;; under the terms of the GNU General Public License as published by > +;;; the Free Software Foundation; either version 3 of the License, or (at > +;;; your option) any later version. > +;;; > +;;; GNU Guix is distributed in the hope that it will be useful, but > +;;; WITHOUT ANY WARRANTY; without even the implied warranty of > +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +;;; GNU General Public License for more details. > +;;; > +;;; You should have received a copy of the GNU General Public License > +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. > + > +(define-module (gnu packages simulation) > + #:use-module (gnu packages) > + #:use-module (gnu packages base) > + #:use-module (gnu packages bash) > + #:use-module (gnu packages bison) > + #:use-module (gnu packages boost) > + #:use-module (gnu packages compression) > + #:use-module (gnu packages flex) > + #:use-module (gnu packages gettext) > + #:use-module (gnu packages gcc) > + #:use-module (gnu packages gl) > + #:use-module (gnu packages graphics) > + #:use-module (gnu packages gtk) > + #:use-module (gnu packages linux) > + #:use-module (gnu packages m4) > + #:use-module (gnu packages maths) > + #:use-module (gnu packages mpi) > + #:use-module (gnu packages multiprecision) > + #:use-module (gnu packages ncurses) > + #:use-module (gnu packages readline) > + #:use-module (gnu packages tls) > + #:use-module (gnu packages version-control) > + #:use-module (gnu packages xml) > + #:use-module (gnu packages xorg) > + #:use-module (guix download) > + #:use-module (guix build utils) > + #:use-module (guix build-system gnu) > + #:use-module ((guix licenses) #:prefix license:) > + #:use-module (guix packages) > + #:use-module (guix utils) > + #:use-module (ice-9 ftw) > + #:use-module (ice-9 regex) > + #:use-module (srfi srfi-1)) > + > +(define-public openfoam > + (package > + (name "openfoam") > + (version "4.1") > + (source > + (origin > + (method url-fetch) > + (uri (string-append > + "http://dl.openfoam.org/source/" > + (string-replace-substring version "." "-"))) > + (file-name (string-append name "-" version ".tar.gz")) > + (sha256 > + (base32 "1hgh2kw7fqv4bfachhbjhw16v8j35jbv6s576fmz4ka2q4ks4wg3")) > + (patches (search-patches "openfoam-cleanup.patch")) > + (modules '((guix build utils))))) > + (build-system gnu-build-system) > + (native-inputs > + `(("bison" ,bison))) > + (propagated-inputs > + `(("boost" ,boost) > + ("cgal" ,cgal) > + ("flex" ,flex) > + ("git" ,git) > + ("gmp" ,gmp) > + ("gzip" ,gzip) > + ("gnuplot" ,gnuplot) > + ("libxt" ,libxt) > + ("metis" ,metis) > + ("mpfr" ,mpfr) > + ("ncurses" ,ncurses) > + ("openmpi" ,openmpi) > + ("readline" ,readline) > + ("scotch" ,pt-scotch) > + ("zlib" ,zlib))) We try to avoid propagating inputs to minimize risk of profile conflicts. Typically, the linker will add things to RUNPATH as necessary and then we only have to fully qualify command-line references and e.g. dlopen()'d solibs. Can you try making these normal inputs? If the dependencies show up in "guix gc -R $(./pre-inst-env guix build openfoam)" when added as regular inputs, propagation is usually not necessary. > + (arguments > + `(;; executable files and shared libraries are located in the 'platforms' > + ;; subdirectory > + #:strip-directories (list (string-append > + "OpenFOAM-" ,version > + "/platforms/linux64GccDPInt32Opt/bin") > + (string-append > + "OpenFOAM-" ,version > + "/platforms/linux64GccDPInt32Opt/lib")) > + ;; '#:elf-directories' is not recognised here so skip validation phase > + #:validate-runpath? #f I don't suppose it's easy to move everything up to the top store level, which is already in a versioned directory and would allow these phases to proceed normally? > + #:phases (modify-phases %standard-phases > + (add-after 'unpack 'rename-build-directory > + (lambda _ > + (use-modules (ice-9 ftw)) > + (use-modules (ice-9 regex)) > + (chdir "..") > + ;; use 'OpenFOAM-version' convention to match path name > + ;; expectations in the build phase > + (let ((unpack-dir (string-append > + (getcwd) "/" > + (list-ref (scandir (getcwd) (lambda (name) > + (string-match "^OpenFOAM" name))) 0))) > + (build-dir (string-append > + (getcwd) "/OpenFOAM-" ,version))) > + ;; re-name build directory > + (rename-file unpack-dir build-dir) > + ;; move to build directory > + (chdir (basename build-dir))))) Nit-pick: (chdir ...) (and setenv below) have unspecified return values, so please add an explicit #t at the end of such phases for determinism. Consult the Guile manual when unsure if a return value can be "trusted". > + (add-after 'patch-source-shebangs 'set-environment-variables > + (lambda _ > + (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch"))) > + ;; set variables to define store paths > + (for-each (lambda (library) > + (setenv (string-append > + (string-upcase library) "_ROOT") > + (assoc-ref %build-inputs library))) libraries)) > + ;; set variables to define package versions > + (setenv "SCOTCHVERSION" ,(package-version scotch)) > + (setenv "METISVERSION" ,(package-version metis)))) > + (delete 'configure) ; no configure phase > + (delete 'patch-generated-file-shebangs) ; no generated files Does this phase fail somehow, or is it deleted simply because it's not needed? Just curious :-) > + (replace 'build > + (lambda _ > + ;; compile OpenFOAM libraries and applications > + (zero? (system (format #f > + "source ./etc/bashrc && ./Allwmake -j~a" > + (parallel-job-count)))))) > + (add-after 'build 'update-configuration-files > + (lambda _ > + ;; record store paths and package versions in configuration files > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$CGAL_ROOT" "etc/config.sh/CGAL"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$BOOST_ROOT" "etc/config.sh/CGAL"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$METIS_ROOT" "etc/config.sh/metis"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$METISVERSION" "etc/config.sh/metis"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$SCOTCH_ROOT" "etc/config.sh/scotch"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$SCOTCHVERSION" "etc/config.sh/scotch"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$GMP_ROOT" "etc/config.sh/settings"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$MPFR_ROOT" "etc/config.sh/settings"))))) Can you try to use (substitute* ...) here instead? I failed to parse the four single quotes in the sed expression in the format string :-/ > + (delete 'check) ; no tests to run You can set #:tests? #f instead of deleting this phase. > + (replace 'install > + (lambda _ > + ;; use 'OpenFOAM-version' convention > + (let ((install-dir (string-append > + %output "/OpenFOAM-" ,version))) > + ;; create install directory > + (mkdir-p install-dir) > + ;; move contents of build directory to install directory > + (copy-recursively "." install-dir))))))) Related to the earlier question, but it would be nice if we could just copy the contents of platforms/linux64GccDPInt32Opt to %output directly. > + ;; Note: tutorial files are installed read-only in /gnu/store. > + ;; To allow write permissions on files copied from the store a > + ;; 'chmod' step is needed before running the applications. For > + ;; example, from a user's login: > + ;; $ source $GUIX_PROFILE/OpenFOAM-4.1/etc/bashrc > + ;; $ mkdir -p $FOAM_RUN > + ;; $ cd $FOAM_RUN > + ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzdaily . > + ;; $ cd pitzdaily > + ;; $ chmod -R u+w . > + ;; $ blockMesh > + (native-search-paths > + ;; define the FOAM_INST_DIR variable > + (list (search-path-specification > + (variable "FOAM_INST_DIR") > + (files '("."))))) ...maybe by utilizing this variable? It would also be better to wrap the binaries with it, instead of depending on it being in a profile. > + (synopsis "Framework for numerical simulation of fluid flow") > + (description "OpenFOAM provides a set of solvers and methods for tackling > +problems in the field of Computational Fluid Dynamics (CFD). It is written in > +C++. Complex governing equations such as the Navier-Stokes equations can be > +solved in integral form. Physical processes such as phase change, droplet > +transport and chemical reaction can be modelled. Numerical methods are > +included to deal with sharp gradients, such as those encountered in flows with > +shock waves and flows with gas/liquid interfaces. > + > +OpenFOAM implements the Finite Volume Method for discretizing the spacial > +dimensions. Computational grids defining geometries in two- and > +three-dimensional domains may be generated by the included blockMesh and > +snappyHexMesh routines or imported from external grid-generation packages. > +Grids may be unstructured in layout and may contain any combination of > +polyhedral cells. Large problems may be split into smaller, connected > +problems for efficient solution on parallel systems") Missing ".' ---> ^^^ Having packaged a fair share of academic software myself, I fully expect that some of the suggestions above are overly optimistic, but had to ask regardless ;-) Hopefully it didn't sound too demanding. Can you send an updated patch please? :-) [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 487 bytes --] ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-08-11 11:06 ` [bug#28045] [PATCH] gnu: Add openfoam Paul Garlick 2017-08-14 23:07 ` Marius Bakke @ 2017-08-15 2:49 ` Eric Bavier 2017-08-16 17:52 ` Paul Garlick 2017-09-07 22:41 ` [bug#28045] [PATCH] gnu: Add openfoam] Paul Garlick 2 siblings, 1 reply; 22+ messages in thread From: Eric Bavier @ 2017-08-15 2:49 UTC (permalink / raw) To: Paul Garlick; +Cc: 28045 Hello Paul, Thank you for the patch! I started this response before Marius's reply. I hope the two do not overlap too much: On Fri, 11 Aug 2017 12:06:36 +0100 Paul Garlick <pgarlick@tourbillion-technology.com> wrote: > * gnu/packages/simulation.scm: New file Would this package not fit nicely in gnu/packages/engineering.scm? > * gnu/packages/patches/openfoam-cleanup.patch: New file See comments below. > * gnu/local.mk(GNU_SYSTEM_MODULES): Add module > (dist_patch_DATA): Add patch ^ ChangeLog conventions would have this opening paren in column 0. > --- > gnu/local.mk | 2 + > gnu/packages/patches/openfoam-cleanup.patch | 251 ++++++++++++++++++++++++++++ > gnu/packages/simulation.scm | 197 ++++++++++++++++++++++ > 3 files changed, 450 insertions(+) > create mode 100644 gnu/packages/patches/openfoam-cleanup.patch > create mode 100644 gnu/packages/simulation.scm > > diff --git a/gnu/local.mk b/gnu/local.mk > index 4b2bdfe37..b00ec1ac7 100644 > --- a/gnu/local.mk > +++ b/gnu/local.mk > @@ -357,6 +357,7 @@ GNU_SYSTEM_MODULES = \ > %D%/packages/shells.scm \ > %D%/packages/shellutils.scm \ > %D%/packages/simh.scm \ > + %D%/packages/simulation.scm \ > %D%/packages/skarnet.scm \ > %D%/packages/skribilo.scm \ > %D%/packages/slang.scm \ > @@ -866,6 +867,7 @@ dist_patch_DATA = \ > %D%/packages/patches/ola-readdir-r.patch \ > %D%/packages/patches/openscenegraph-ffmpeg3.patch \ > %D%/packages/patches/openexr-missing-samples.patch \ > + %D%/packages/patches/openfoam-cleanup.patch \ > %D%/packages/patches/openjpeg-CVE-2016-9850-CVE-2016-9851.patch \ > %D%/packages/patches/openjpeg-CVE-2016-9572-CVE-2016-9573.patch \ > %D%/packages/patches/openldap-CVE-2017-9287.patch \ > diff --git a/gnu/packages/patches/openfoam-cleanup.patch b/gnu/packages/patches/openfoam-cleanup.patch > new file mode 100644 > index 000000000..b2c0ddcd1 > --- /dev/null > +++ b/gnu/packages/patches/openfoam-cleanup.patch > @@ -0,0 +1,251 @@ > +# This patch removes all need for the ThirdParty files of OpenFOAM > + > +# Derived from easybuild patch: Ward Poelmans <wpoely86@gmail.com> > +# Modified for GNU Guix: Paul Garlick <pgarlick@tourbillion-technology.com> > + > +diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake > +--- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake > ++++ OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake > +@@ -9,7 +9,7 @@ > + # > + # use readline if available > + # > +-if [ -f /usr/include/readline/readline.h ] > ++if true > + then > + echo "Found <readline/readline.h> -- enabling readline support." > + export COMP_FLAGS="-DHAS_READLINE" > +diff -ur OpenFOAM-4.x-version-4.1.org/etc/bashrc OpenFOAM-4.x-version-4.1/etc/bashrc > +--- OpenFOAM-4.x-version-4.1.org/etc/bashrc > ++++ OpenFOAM-4.x-version-4.1/etc/bashrc > +@@ -43,8 +43,10 @@ > + # Please set to the appropriate path if the default is not correct. > + # > + [ $BASH_SOURCE ] && \ > +-export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \ > ++export FOAM_INST_DIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) || \ > + export FOAM_INST_DIR=$HOME/$WM_PROJECT > ++# For GNU Guix: set initially for build then re-set at runtime > ++# > + # export FOAM_INST_DIR=~$WM_PROJECT > + # export FOAM_INST_DIR=/opt/$WM_PROJECT > + # export FOAM_INST_DIR=/usr/local/$WM_PROJECT > +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL > +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL > ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL > +@@ -36,37 +36,7 @@ > + # > + #------------------------------------------------------------------------------ > + > +-boost_version=boost-system > +-cgal_version=cgal-system > +-#cgal_version=CGAL-4.8 > +- > +-if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ] > +-then > +- > +- common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER > +- > +- export BOOST_ARCH_PATH=$common_path/$boost_version > +- export CGAL_ARCH_PATH=$common_path/$cgal_version > +- > +- if [ "$FOAM_VERBOSE" -a "$PS1" ] > +- then > +- echo "Using CGAL and boost" 1>&2 > +- echo " $cgal_version at $CGAL_ARCH_PATH" 1>&2 > +- echo " $boost_version at $BOOST_ARCH_PATH" 1>&2 > +- fi > +- > +- if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ] > +- then > +- _foamAddLib $CGAL_ARCH_PATH/lib > +- fi > +- > +- if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ] > +- then > +- _foamAddLib $BOOST_ARCH_PATH/lib > +- fi > +- > +- unset boost_version cgal_version common_path > +- > +-fi > ++export CGAL_ARCH_PATH=$CGAL_ROOT > ++export BOOST_ARCH_PATH=$BOOST_ROOT > + > + #------------------------------------------------------------------------------ > +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools > +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools 2016-10-16 16:11:45.000000000 +0200 > ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools 2017-04-10 14:51:01.473221230 +0200 > +@@ -29,13 +29,13 @@ > + # > + #------------------------------------------------------------------------------ > + > +-version=svn > +-gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER > +- > +-GPERFTOOLS_VERSION=gperftools-$version > +-GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION > +- > +-export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH > +-export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH > ++# version=svn > ++# gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER > ++# > ++# GPERFTOOLS_VERSION=gperftools-$version > ++# GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION > ++# > ++# export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH > ++# export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH > + > + #------------------------------------------------------------------------------ > +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-version-4.1/etc/config.sh/metis > +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis > ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/metis > +@@ -34,7 +34,7 @@ > + # > + #------------------------------------------------------------------------------ > + > +-export METIS_VERSION=metis-5.1.0 > +-export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION > ++export METIS_VERSION=metis-$METISVERSION > ++export METIS_ARCH_PATH=$METIS_ROOT > + > + #------------------------------------------------------------------------------ > +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch OpenFOAM-4.x-version-4.1/etc/config.sh/scotch > +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch > ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/scotch > +@@ -37,7 +37,7 @@ > + # > + #------------------------------------------------------------------------------ > + > +-export SCOTCH_VERSION=scotch_6.0.3 > +-export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION > ++export SCOTCH_VERSION=scotch_$SCOTCHVERSION > ++export SCOTCH_ARCH_PATH=$SCOTCH_ROOT > + > + #------------------------------------------------------------------------------ > +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings OpenFOAM-4.x-version-4.1/etc/config.sh/settings > +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings > ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/settings > +@@ -279,6 +279,9 @@ > + ;; > + system) > + # Use system compiler > ++ # Use system GMP and MPFR packages > ++ export GMP_ARCH_PATH=$GMP_ROOT > ++ export MPFR_ARCH_PATH=$MPFR_ROOT > + ;; > + *) > + echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2 > +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options > +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options > ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options > +@@ -5,8 +5,7 @@ > + $(PFLAGS) $(PINC) \ > + -I$(SCOTCH_ROOT)/include \ > + -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \ > +- -I/usr/include/scotch \ > + -I../decompositionMethods/lnInclude > + > + LIB_LIBS = \ > +- -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt > ++ -L$(SCOTCH_ROOT)/lib -L$(MPI_ARCH_PATH)/lib -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt > +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options > +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options > ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options > +@@ -9,8 +9,7 @@ > + $(PFLAGS) $(PINC) \ > + -I$(SCOTCH_ROOT)/include \ > + -I$(SCOTCH_ARCH_PATH)/include \ > +- -I/usr/include/scotch \ > + -I../decompositionMethods/lnInclude > + > + LIB_LIBS = \ > +- -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt > ++ -L$(SCOTCH_ROOT)/lib -lscotch -lscotcherrexit -lrt > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/src/Makefile OpenFOAM-4.x-version-4.1/wmake/src/Makefile > +--- OpenFOAM-4.x-version-4.1.org/wmake/src/Makefile > ++++ OpenFOAM-4.x-version-4.1/wmake/src/Makefile > +@@ -33,7 +33,7 @@ > + # The Makefile use a POSIX shell > + #------------------------------------------------------------------------------ > + > +-SHELL = /bin/sh > ++# SHELL = /bin/sh > + > + #------------------------------------------------------------------------------ > + # Unset suffices list (suffix rules are not used) > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general > +--- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general > ++++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general > +@@ -33,7 +33,7 @@ > + # The Makefile uses a POSIX shell > + #------------------------------------------------------------------------------ > + > +-SHELL = /bin/sh > ++# SHELL = /bin/sh > + > + > + #------------------------------------------------------------------------------ > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmake OpenFOAM-4.x-version-4.1/wmake/wmake > +--- OpenFOAM-4.x-version-4.1.org/wmake/wmake > ++++ OpenFOAM-4.x-version-4.1/wmake/wmake > +@@ -163,7 +163,7 @@ > + then > + if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ] > + then > +- lockDir=$HOME/.$WM_PROJECT/.wmake > ++ lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake > + > + if [ -d $lockDir ] > + then > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler > +--- OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler > ++++ OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler > +@@ -53,7 +53,7 @@ > + # csh sets HOST, bash sets HOSTNAME > + : ${HOST:=$HOSTNAME} > + > +-lockDir=$HOME/.$WM_PROJECT/.wmake > ++lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake > + > + # Fallback - 1 core on current host > + : ${WM_HOSTS:=$HOST:1} > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime > +--- OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime > ++++ OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime > +@@ -53,7 +53,7 @@ > + # csh sets HOST, bash sets HOSTNAME > + : ${HOST:=$HOSTNAME} > + > +-lockDir=$HOME/.$WM_PROJECT/.wmake > ++lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake > + # Fallback - 1 core on current host > + : ${WM_HOSTS:=$HOST:1} > + > +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C > +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C > ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C > +@@ -67,7 +67,7 @@ > + > + // Processor weights initialised with no size, only used if specified in > + // a file > +- Field<scalar> processorWeights; > ++ Field<floatScalar> processorWeights; > + > + // Cell weights (so on the vertices of the dual) > + List<label> cellWeights; > +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL > +--- OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL > ++++ OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL > +@@ -6,8 +6,8 @@ > + -I/usr/include > + > + CGAL_LIBS = \ > +- -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ > +- -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ > ++ -L$(MPFR_ARCH_PATH)/lib \ > ++ -L$(GMP_ARCH_PATH)/lib \ > + -L$(BOOST_ARCH_PATH)/lib \ > + -L$(CGAL_ARCH_PATH)/lib \ > + -lCGAL \ > diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm > new file mode 100644 > index 000000000..5aa5f8f03 > --- /dev/null > +++ b/gnu/packages/simulation.scm > @@ -0,0 +1,197 @@ > +;;; GNU Guix --- Functional package management for GNU > +;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com> > +;;; > +;;; This file is part of GNU Guix. > +;;; > +;;; GNU Guix is free software; you can redistribute it and/or modify it > +;;; under the terms of the GNU General Public License as published by > +;;; the Free Software Foundation; either version 3 of the License, or (at > +;;; your option) any later version. > +;;; > +;;; GNU Guix is distributed in the hope that it will be useful, but > +;;; WITHOUT ANY WARRANTY; without even the implied warranty of > +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +;;; GNU General Public License for more details. > +;;; > +;;; You should have received a copy of the GNU General Public License > +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. > + > +(define-module (gnu packages simulation) > + #:use-module (gnu packages) > + #:use-module (gnu packages base) > + #:use-module (gnu packages bash) > + #:use-module (gnu packages bison) > + #:use-module (gnu packages boost) > + #:use-module (gnu packages compression) > + #:use-module (gnu packages flex) > + #:use-module (gnu packages gettext) > + #:use-module (gnu packages gcc) > + #:use-module (gnu packages gl) > + #:use-module (gnu packages graphics) > + #:use-module (gnu packages gtk) > + #:use-module (gnu packages linux) > + #:use-module (gnu packages m4) > + #:use-module (gnu packages maths) > + #:use-module (gnu packages mpi) > + #:use-module (gnu packages multiprecision) > + #:use-module (gnu packages ncurses) > + #:use-module (gnu packages readline) > + #:use-module (gnu packages tls) > + #:use-module (gnu packages version-control) > + #:use-module (gnu packages xml) > + #:use-module (gnu packages xorg) > + #:use-module (guix download) > + #:use-module (guix build utils) > + #:use-module (guix build-system gnu) > + #:use-module ((guix licenses) #:prefix license:) > + #:use-module (guix packages) > + #:use-module (guix utils) > + #:use-module (ice-9 ftw) > + #:use-module (ice-9 regex) > + #:use-module (srfi srfi-1)) > + > +(define-public openfoam > + (package > + (name "openfoam") > + (version "4.1") > + (source > + (origin > + (method url-fetch) > + (uri (string-append > + "http://dl.openfoam.org/source/" > + (string-replace-substring version "." "-"))) We have a couple other packages that use string-replace-substring, but I personally think it's overkill for single-character replacements like this. FWIW: scheme@(guile-user)> ,time (let loop ((i 10000000)) (when (> i 0) (string-replace-substring version "." "-") (loop (- i 1))))) ;; 12.317051s real time, 16.041830s run time. 5.452976s spent in GC. scheme@(guile-user)> ,time (let loop ((i 10000000)) (when (> i 0) (string-map (lambda (x) (if (eq? x #\.) #\- x)) version) (loop (- i 1))))) ;; 3.586351s real time, 4.464542s run time. 1.285729s spent in GC. > + (file-name (string-append name "-" version ".tar.gz")) > + (sha256 > + (base32 "1hgh2kw7fqv4bfachhbjhw16v8j35jbv6s576fmz4ka2q4ks4wg3")) > + (patches (search-patches "openfoam-cleanup.patch")) > + (modules '((guix build utils))))) The modules field is not needed AFAICT. Usually only when a 'snippet' is used. > + (build-system gnu-build-system) > + (native-inputs > + `(("bison" ,bison))) > + (propagated-inputs > + `(("boost" ,boost) > + ("cgal" ,cgal) > + ("flex" ,flex) > + ("git" ,git) > + ("gmp" ,gmp) > + ("gzip" ,gzip) > + ("gnuplot" ,gnuplot) > + ("libxt" ,libxt) > + ("metis" ,metis) > + ("mpfr" ,mpfr) > + ("ncurses" ,ncurses) > + ("openmpi" ,openmpi) > + ("readline" ,readline) > + ("scotch" ,pt-scotch) > + ("zlib" ,zlib))) > + (arguments > + `(;; executable files and shared libraries are located in the 'platforms' > + ;; subdirectory > + #:strip-directories (list (string-append > + "OpenFOAM-" ,version > + "/platforms/linux64GccDPInt32Opt/bin") > + (string-append > + "OpenFOAM-" ,version > + "/platforms/linux64GccDPInt32Opt/lib")) > + ;; '#:elf-directories' is not recognised here so skip validation phase > + #:validate-runpath? #f > + #:phases (modify-phases %standard-phases > + (add-after 'unpack 'rename-build-directory > + (lambda _ > + (use-modules (ice-9 ftw)) > + (use-modules (ice-9 regex)) > + (chdir "..") > + ;; use 'OpenFOAM-version' convention to match path name > + ;; expectations in the build phase > + (let ((unpack-dir (string-append > + (getcwd) "/" > + (list-ref (scandir (getcwd) (lambda (name) > + (string-match "^OpenFOAM" name))) 0))) > + (build-dir (string-append > + (getcwd) "/OpenFOAM-" ,version))) > + ;; re-name build directory > + (rename-file unpack-dir build-dir) > + ;; move to build directory > + (chdir (basename build-dir))))) > + (add-after 'patch-source-shebangs 'set-environment-variables > + (lambda _ > + (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch"))) > + ;; set variables to define store paths > + (for-each (lambda (library) > + (setenv (string-append > + (string-upcase library) "_ROOT") > + (assoc-ref %build-inputs library))) libraries)) > + ;; set variables to define package versions > + (setenv "SCOTCHVERSION" ,(package-version scotch)) > + (setenv "METISVERSION" ,(package-version metis)))) > + (delete 'configure) ; no configure phase > + (delete 'patch-generated-file-shebangs) ; no generated files > + (replace 'build > + (lambda _ > + ;; compile OpenFOAM libraries and applications > + (zero? (system (format #f > + "source ./etc/bashrc && ./Allwmake -j~a" > + (parallel-job-count)))))) > + (add-after 'build 'update-configuration-files > + (lambda _ > + ;; record store paths and package versions in configuration files > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$CGAL_ROOT" "etc/config.sh/CGAL"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$BOOST_ROOT" "etc/config.sh/CGAL"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$METIS_ROOT" "etc/config.sh/metis"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$METISVERSION" "etc/config.sh/metis"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$SCOTCH_ROOT" "etc/config.sh/scotch"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$SCOTCHVERSION" "etc/config.sh/scotch"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$GMP_ROOT" "etc/config.sh/settings"))) > + (zero? (system (format #f "sed -i 's|~a|'~:*~s'|' ~a" > + "$MPFR_ROOT" "etc/config.sh/settings"))))) Prefer "substitute*" here instead of calling 'sed'. > + (delete 'check) ; no tests to run > + (replace 'install > + (lambda _ > + ;; use 'OpenFOAM-version' convention > + (let ((install-dir (string-append > + %output "/OpenFOAM-" ,version))) > + ;; create install directory > + (mkdir-p install-dir) > + ;; move contents of build directory to install directory > + (copy-recursively "." install-dir))))))) > + ;; Note: tutorial files are installed read-only in /gnu/store. > + ;; To allow write permissions on files copied from the store a > + ;; 'chmod' step is needed before running the applications. For > + ;; example, from a user's login: > + ;; $ source $GUIX_PROFILE/OpenFOAM-4.1/etc/bashrc > + ;; $ mkdir -p $FOAM_RUN > + ;; $ cd $FOAM_RUN > + ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzdaily . > + ;; $ cd pitzdaily > + ;; $ chmod -R u+w . > + ;; $ blockMesh > + (native-search-paths > + ;; define the FOAM_INST_DIR variable > + (list (search-path-specification > + (variable "FOAM_INST_DIR") > + (files '("."))))) > + (synopsis "Framework for numerical simulation of fluid flow") > + (description "OpenFOAM provides a set of solvers and methods for tackling > +problems in the field of Computational Fluid Dynamics (CFD). It is written in > +C++. Complex governing equations such as the Navier-Stokes equations can be > +solved in integral form. Physical processes such as phase change, droplet > +transport and chemical reaction can be modelled. Numerical methods are > +included to deal with sharp gradients, such as those encountered in flows with > +shock waves and flows with gas/liquid interfaces. > + > +OpenFOAM implements the Finite Volume Method for discretizing the spacial > +dimensions. Computational grids defining geometries in two- and > +three-dimensional domains may be generated by the included blockMesh and > +snappyHexMesh routines or imported from external grid-generation packages. > +Grids may be unstructured in layout and may contain any combination of > +polyhedral cells. Large problems may be split into smaller, connected > +problems for efficient solution on parallel systems") This description is a bit long. Could it be condensed? E.g. I think the second paragraph is not necessary here. > + (license license:gpl3+) > + (home-page "https://openfoam.org"))) Could you send an updated patch addressing these and Marius's concerns? Thanks, `~Eric ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-08-15 2:49 ` Eric Bavier @ 2017-08-16 17:52 ` Paul Garlick 2017-08-16 20:04 ` Eric Bavier 0 siblings, 1 reply; 22+ messages in thread From: Paul Garlick @ 2017-08-16 17:52 UTC (permalink / raw) To: Eric Bavier, Marius Bakke; +Cc: 28045 [-- Attachment #1: Type: text/plain, Size: 1342 bytes --] Hello Guix, Thank you Marius and Eric for your reviews and comments. I have been working through the changes and updating the patch. However, in the process of rebasing I have noticed a change in Guix that impacts on the OpenFOAM definition. Specifically, a recent commit (26599d6) has changed the definition of the scotch package so that it now uses 64bit integers. In a nutshell, this causes a build failure in OpenFOAM. In OpenFOAM, there is a variable to specify the size of the integer values (32bit or 64bit). This single variable is used by both metis and scotch, meaning that they both have to use 32bit integers or both use 64bit integers. At present, Guix offers a 64bit scotch and a 32bit metis. A straightforward solution would be to add the extra packages, a 32bit scotch and/or a 64bit metis. For scotch, that would be the same definition, except for the 'INTSIZE64' line. For metis, that would involve an edit of 'metis.h', setting IDXTYPEWIDTH and REALTYPEWIDTH to 64. Would you prefer this to be the subject of a separate patch, or included in the OpenFOAM patch? There is also a question about how to name the packages; scotch and scotch32, for example, or scotch and scotch-64int etc. Best regards, Paul On Mon, 2017-08-14 at 21:49 -0500, Eric Bavier wrote: > Hello Paul, > > Thank you for the patch! > > [-- Attachment #2: Type: text/html, Size: 1667 bytes --] ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-08-16 17:52 ` Paul Garlick @ 2017-08-16 20:04 ` Eric Bavier 2017-08-17 9:42 ` Paul Garlick 0 siblings, 1 reply; 22+ messages in thread From: Eric Bavier @ 2017-08-16 20:04 UTC (permalink / raw) To: Paul Garlick, Marius Bakke; +Cc: 28045 [-- Attachment #1: Type: text/plain, Size: 2112 bytes --] Scotch's INTSIZE64 is a bit of a misnomer, as it simply tells scotch to use the 'long' type rather than 'int'. IIRC, Ludovic's rational was that this would be 32 bits or 64 bit integers depending on the platform. I think this is a reasonable default, but, like you point out, it does mean we need to keep thing consistent across packages. For metis this might mean a build phase that patches metis.h's IDXTYPEWIDTH macro appropriately for the target system. That should be a separate patch. Thanks for working on it, `~Eric On August 16, 2017 12:52:26 PM CDT, Paul Garlick <pgarlick@tourbillion-technology.com> wrote: >Hello Guix, >Thank you Marius and Eric for your reviews and comments. >I have been working through the changes and updating the patch. > However, in the process of rebasing I have noticed a change in Guix >that impacts on the OpenFOAM definition. Specifically, a recent commit >(26599d6) has changed the definition of the scotch package so that it >now uses 64bit integers. In a nutshell, this causes a build failure in >OpenFOAM. >In OpenFOAM, there is a variable to specify the size of the integer >values (32bit or 64bit). This single variable is used by both metis >and scotch, meaning that they both have to use 32bit integers or both >use 64bit integers. At present, Guix offers a 64bit scotch and a 32bit >metis. >A straightforward solution would be to add the extra packages, a 32bit >scotch and/or a 64bit metis. For scotch, that would be the same >definition, except for the 'INTSIZE64' line. For metis, that would >involve an edit of 'metis.h', setting IDXTYPEWIDTH and REALTYPEWIDTH to >64. >Would you prefer this to be the subject of a separate patch, or >included in the OpenFOAM patch? There is also a question about how to >name the packages; scotch and scotch32, for example, or scotch and >scotch-64int etc. >Best regards, >Paul >On Mon, 2017-08-14 at 21:49 -0500, Eric Bavier wrote: >> Hello Paul, >> >> Thank you for the patch! >> >> -- Sent from my Android device with K-9 Mail. Please excuse my brevity. [-- Attachment #2: Type: text/html, Size: 2631 bytes --] ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-08-16 20:04 ` Eric Bavier @ 2017-08-17 9:42 ` Paul Garlick 2017-08-22 13:02 ` Ludovic Courtès 0 siblings, 1 reply; 22+ messages in thread From: Paul Garlick @ 2017-08-17 9:42 UTC (permalink / raw) To: Eric Bavier, Marius Bakke; +Cc: 28045 Hi Eric, > For metis this might mean a build phase that patches metis.h's > IDXTYPEWIDTH macro appropriately for the target system. I think this would work, in the sense of allowing OpenFOAM to build. There has been a recent FreeBSD bug report on this issue: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219749 The REALTYPEWIDTH would also need to be set to 64-bit for OpenFOAM to avoid a related build problem. However, there could be an argument not to do it this way. That is, with this approach the choice between 32bit and 64bit integers is made according to the system architecture. For OpenFOAM, and perhaps other Guix packages too, there is also a consideration of memory usage and speed. The current default in OpenFOAM is to use 32bit integers, even on 64bit systems. The reasoning is that the need for indexing beyond the 2^32 limit is restricted to the corner-case of dealing with very large graphs on single processors. The computations become very time consuming and an attractive alternative in many cases is to parallelise the problem, thereby avoiding the limit. To stick with the OpenFOAM default a 32bit version of scotch/pt-scotch would be needed. This would mean either reverting commit 26599d6, or introducing a new scotch32 package, the same as the previous definition, guaranteed to use 32bit integers. WDYT? Paul. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-08-17 9:42 ` Paul Garlick @ 2017-08-22 13:02 ` Ludovic Courtès 2017-08-22 17:10 ` Paul Garlick 0 siblings, 1 reply; 22+ messages in thread From: Ludovic Courtès @ 2017-08-22 13:02 UTC (permalink / raw) To: Paul Garlick; +Cc: 28045 Hi Paul, Paul Garlick <pgarlick@tourbillion-technology.com> skribis: > To stick with the OpenFOAM default a 32bit version of scotch/pt-scotch > would be needed. This would mean either reverting commit 26599d6, or > introducing a new scotch32 package, the same as the previous > definition, guaranteed to use 32bit integers. I think we should introduce a “scotch32” variant (with a clear explanation of what the “32” means). Thoughts? Ludo’. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-08-22 13:02 ` Ludovic Courtès @ 2017-08-22 17:10 ` Paul Garlick 2017-08-22 22:33 ` Ludovic Courtès 0 siblings, 1 reply; 22+ messages in thread From: Paul Garlick @ 2017-08-22 17:10 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 28045 Hi Ludo, > I think we should introduce a “scotch32” variant (with a clear > explanation of what the “32” means). I think this is the most flexible approach. Packages could then select the standard 'scotch' or, if preferred, the 'scotch32' variant, if memory usage or performance is a concern. A method of implementing this would be for 'scotch32' to inherit the 'scotch' definition, replacing the configure phase with a similar section specifying INTSIZE32 instead of INTSIZE64. This would be similar to the Debian approach, in which a different Makefile.inc is used for 32-bit and 64-bit integers. A new package 'pt-scotch32' would then be the same as 'pt-scotch' but inherit from 'scotch32' instead of 'scotch'. Any comments? Paul. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-08-22 17:10 ` Paul Garlick @ 2017-08-22 22:33 ` Ludovic Courtès 2017-08-30 15:08 ` Paul Garlick 0 siblings, 1 reply; 22+ messages in thread From: Ludovic Courtès @ 2017-08-22 22:33 UTC (permalink / raw) To: Paul Garlick; +Cc: 28045 Hi Paul, Paul Garlick <pgarlick@tourbillion-technology.com> skribis: > A method of implementing this would be for 'scotch32' to inherit the > 'scotch' definition, replacing the configure phase with a similar > section specifying INTSIZE32 instead of INTSIZE64. This would be > similar to the Debian approach, in which a different Makefile.inc is > used for 32-bit and 64-bit integers. > > A new package 'pt-scotch32' would then be the same as 'pt-scotch' but > inherit from 'scotch32' instead of 'scotch'. > > Any comments? This sounds like the right approach to me (you could even omit ‘pt-scotch32’ as a first stab if you don’t need it for Openfoam.) Ludo’. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-08-22 22:33 ` Ludovic Courtès @ 2017-08-30 15:08 ` Paul Garlick 2017-09-06 21:28 ` Paul Garlick 0 siblings, 1 reply; 22+ messages in thread From: Paul Garlick @ 2017-08-30 15:08 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 28045 Hi Guix, > This sounds like the right approach to me (you could even omit > ‘pt-scotch32’ as a first stab if you don’t need it for Openfoam.) I have submitted a patch for 'scotch32' and'pt-scotch32' packages (bugs #28220 and #28221). OpenFoam depends on both of them. After the scotch32 patches have been committed I will rebase again and re-check that the build succeeds before re-submitting the OpenFoam patch. Best regards, Paul. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-08-30 15:08 ` Paul Garlick @ 2017-09-06 21:28 ` Paul Garlick 2017-09-07 11:57 ` Ludovic Courtès 0 siblings, 1 reply; 22+ messages in thread From: Paul Garlick @ 2017-09-06 21:28 UTC (permalink / raw) To: 28045; +Cc: Paul Garlick *gnu/packages/patches/openfoam-4.1-cleanup.patch: New file *gnu/packages/simulation.scm: New file *gnu/local.mk (GNU_SYSTEM_MODULES): Add module (dist_patch_DATA): Add patch --- gnu/local.mk | 2 + gnu/packages/patches/openfoam-4.1-cleanup.patch | 239 ++++++++++++++++++++++++ gnu/packages/simulation.scm | 198 ++++++++++++++++++++ 3 files changed, 439 insertions(+) create mode 100644 gnu/packages/patches/openfoam-4.1-cleanup.patch create mode 100644 gnu/packages/simulation.scm Hello Guix, Please find the updated patch for OpenFOAM below. Thank you for the reviews. I have implemented the suggestions made by Ludo, Eric and Marius, barring a couple of exceptions noted below. I have also changed the filename for the patch, in order to include the version. This will allow new versions to have their own patches. Lastly, I have added a section in the patch to rename the 'lockDir' variable temporarily for the build phase. It is reset in the 'update-configuration-files' phase. In answer to the specific comments: >> +- Field<scalar> processorWeights; >> ++ Field<floatScalar> processorWeights; > >This seems unrelated to unbundling :) Is this a known issue? Yes, this is OpenFOAM bug#0002085. I believe a fix has been implemented so that this part of the patch will not be needed in future versions. >> + #:validate-runpath? #f > >I don't suppose it's easy to move everything up to the top store level, >which is already in a versioned directory and would allow these phases >to proceed normally? I think it would be difficult to make a change here, without risking disruption to internal paths and external (user) scripts. >> + ;; define the FOAM_INST_DIR variable >> + (list (search-path-specification >> + (variable "FOAM_INST_DIR") >> + (files '("."))))) > >...maybe by utilizing this variable? It would also be better to wrap >the binaries with it, instead of depending on it being in a profile. This variable is often used in user aliases and scripts. It is used as the starting point for navigating the OpenFOAM directory structure. Other installation methods make the variable immediately available. If it were missing in the Guix package it would be necessary to add an explanation of how it should be set. >> * gnu/packages/simulation.scm: New file > >Would this package not fit nicely in gnu/packages/engineering.scm? In fact, there was some discussion on this question when I submitted the original patch: http://lists.gnu.org/archive/html/guix-devel/2017-07/msg00354.html I think the 'simulation' module is the best idea since there are also many non-engineering applications such as biomedical and geophysical modelling. Best regards, Paul. diff --git a/gnu/local.mk b/gnu/local.mk index 643a88db8..048f7aa1c 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -363,6 +363,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/shells.scm \ %D%/packages/shellutils.scm \ %D%/packages/simh.scm \ + %D%/packages/simulation.scm \ %D%/packages/skarnet.scm \ %D%/packages/skribilo.scm \ %D%/packages/slang.scm \ @@ -886,6 +887,7 @@ dist_patch_DATA = \ %D%/packages/patches/ola-readdir-r.patch \ %D%/packages/patches/openscenegraph-ffmpeg3.patch \ %D%/packages/patches/openexr-missing-samples.patch \ + %D%/packages/patches/openfoam-4.1-cleanup.patch \ %D%/packages/patches/openjpeg-CVE-2017-12982.patch \ %D%/packages/patches/openjpeg-CVE-2017-14040.patch \ %D%/packages/patches/openjpeg-CVE-2017-14041.patch \ diff --git a/gnu/packages/patches/openfoam-4.1-cleanup.patch b/gnu/packages/patches/openfoam-4.1-cleanup.patch new file mode 100644 index 000000000..590db5982 --- /dev/null +++ b/gnu/packages/patches/openfoam-4.1-cleanup.patch @@ -0,0 +1,239 @@ +# This patch removes all need for the ThirdParty files of OpenFOAM + +# Derived from easybuild patch: Ward Poelmans <wpoely86@gmail.com> +# Modified for GNU Guix: Paul Garlick <pgarlick@tourbillion-technology.com> + +diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake +--- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake ++++ OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake +@@ -9,7 +9,7 @@ + # + # use readline if available + # +-if [ -f /usr/include/readline/readline.h ] ++if true + then + echo "Found <readline/readline.h> -- enabling readline support." + export COMP_FLAGS="-DHAS_READLINE" +diff -ur OpenFOAM-4.x-version-4.1.org/etc/bashrc OpenFOAM-4.x-version-4.1/etc/bashrc +--- OpenFOAM-4.x-version-4.1.org/etc/bashrc ++++ OpenFOAM-4.x-version-4.1/etc/bashrc +@@ -43,8 +43,10 @@ + # Please set to the appropriate path if the default is not correct. + # + [ $BASH_SOURCE ] && \ +-export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \ ++export FOAM_INST_DIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) || \ + export FOAM_INST_DIR=$HOME/$WM_PROJECT ++# For GNU Guix: set initially for build then re-set at runtime ++# + # export FOAM_INST_DIR=~$WM_PROJECT + # export FOAM_INST_DIR=/opt/$WM_PROJECT + # export FOAM_INST_DIR=/usr/local/$WM_PROJECT +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL +@@ -36,37 +36,7 @@ + # + #------------------------------------------------------------------------------ + +-boost_version=boost-system +-cgal_version=cgal-system +-#cgal_version=CGAL-4.8 +- +-if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ] +-then +- +- common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER +- +- export BOOST_ARCH_PATH=$common_path/$boost_version +- export CGAL_ARCH_PATH=$common_path/$cgal_version +- +- if [ "$FOAM_VERBOSE" -a "$PS1" ] +- then +- echo "Using CGAL and boost" 1>&2 +- echo " $cgal_version at $CGAL_ARCH_PATH" 1>&2 +- echo " $boost_version at $BOOST_ARCH_PATH" 1>&2 +- fi +- +- if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ] +- then +- _foamAddLib $CGAL_ARCH_PATH/lib +- fi +- +- if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ] +- then +- _foamAddLib $BOOST_ARCH_PATH/lib +- fi +- +- unset boost_version cgal_version common_path +- +-fi ++export CGAL_ARCH_PATH=$CGAL_ROOT ++export BOOST_ARCH_PATH=$BOOST_ROOT + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools 2016-10-16 16:11:45.000000000 +0200 ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools 2017-04-10 14:51:01.473221230 +0200 +@@ -29,13 +29,13 @@ + # + #------------------------------------------------------------------------------ + +-version=svn +-gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER +- +-GPERFTOOLS_VERSION=gperftools-$version +-GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION +- +-export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH +-export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH ++# version=svn ++# gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER ++# ++# GPERFTOOLS_VERSION=gperftools-$version ++# GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION ++# ++# export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH ++# export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-version-4.1/etc/config.sh/metis +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/metis +@@ -34,7 +34,7 @@ + # + #------------------------------------------------------------------------------ + +-export METIS_VERSION=metis-5.1.0 +-export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION ++export METIS_VERSION=metis-$METISVERSION ++export METIS_ARCH_PATH=$METIS_ROOT + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch OpenFOAM-4.x-version-4.1/etc/config.sh/scotch +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/scotch +@@ -37,7 +37,7 @@ + # + #------------------------------------------------------------------------------ + +-export SCOTCH_VERSION=scotch_6.0.3 +-export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION ++export SCOTCH_VERSION=scotch_$SCOTCHVERSION ++export SCOTCH_ARCH_PATH=$SCOTCH_ROOT + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings OpenFOAM-4.x-version-4.1/etc/config.sh/settings +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/settings +@@ -279,6 +279,9 @@ + ;; + system) + # Use system compiler ++ # Use system GMP and MPFR packages ++ export GMP_ARCH_PATH=$GMP_ROOT ++ export MPFR_ARCH_PATH=$MPFR_ROOT + ;; + *) + echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2 +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options +@@ -5,8 +5,7 @@ + $(PFLAGS) $(PINC) \ + -I$(SCOTCH_ROOT)/include \ + -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \ +- -I/usr/include/scotch \ + -I../decompositionMethods/lnInclude + + LIB_LIBS = \ +- -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt ++ -L$(SCOTCH_ROOT)/lib -L$(MPI_ARCH_PATH)/lib -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options +@@ -9,8 +9,7 @@ + $(PFLAGS) $(PINC) \ + -I$(SCOTCH_ROOT)/include \ + -I$(SCOTCH_ARCH_PATH)/include \ +- -I/usr/include/scotch \ + -I../decompositionMethods/lnInclude + + LIB_LIBS = \ +- -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt ++ -L$(SCOTCH_ROOT)/lib -lscotch -lscotcherrexit -lrt +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general +--- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general ++++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general +@@ -33,7 +33,7 @@ + # The Makefile uses a POSIX shell + #------------------------------------------------------------------------------ + +-SHELL = /bin/sh ++# SHELL = /bin/sh + + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmake OpenFOAM-4.x-version-4.1/wmake/wmake +--- OpenFOAM-4.x-version-4.1.org/wmake/wmake ++++ OpenFOAM-4.x-version-4.1/wmake/wmake +@@ -163,7 +163,7 @@ + then + if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ] + then +- lockDir=$HOME/.$WM_PROJECT/.wmake ++ lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake + + if [ -d $lockDir ] + then +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler +--- OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler ++++ OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler +@@ -53,7 +53,7 @@ + # csh sets HOST, bash sets HOSTNAME + : ${HOST:=$HOSTNAME} + +-lockDir=$HOME/.$WM_PROJECT/.wmake ++lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake + + # Fallback - 1 core on current host + : ${WM_HOSTS:=$HOST:1} +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime +--- OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime ++++ OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime +@@ -53,7 +53,7 @@ + # csh sets HOST, bash sets HOSTNAME + : ${HOST:=$HOSTNAME} + +-lockDir=$HOME/.$WM_PROJECT/.wmake ++lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake + # Fallback - 1 core on current host + : ${WM_HOSTS:=$HOST:1} + +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C +@@ -67,7 +67,7 @@ + + // Processor weights initialised with no size, only used if specified in + // a file +- Field<scalar> processorWeights; ++ Field<floatScalar> processorWeights; + + // Cell weights (so on the vertices of the dual) + List<label> cellWeights; +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL +--- OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL ++++ OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL +@@ -6,8 +6,8 @@ + -I/usr/include + + CGAL_LIBS = \ +- -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ +- -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ ++ -L$(MPFR_ARCH_PATH)/lib \ ++ -L$(GMP_ARCH_PATH)/lib \ + -L$(BOOST_ARCH_PATH)/lib \ + -L$(CGAL_ARCH_PATH)/lib \ + -lCGAL \ diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm new file mode 100644 index 000000000..3446d72c6 --- /dev/null +++ b/gnu/packages/simulation.scm @@ -0,0 +1,198 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com> +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. + +(define-module (gnu packages simulation) + #:use-module (gnu packages) + #:use-module (gnu packages base) + #:use-module (gnu packages bash) + #:use-module (gnu packages bison) + #:use-module (gnu packages boost) + #:use-module (gnu packages compression) + #:use-module (gnu packages flex) + #:use-module (gnu packages gettext) + #:use-module (gnu packages gcc) + #:use-module (gnu packages gl) + #:use-module (gnu packages graphics) + #:use-module (gnu packages gtk) + #:use-module (gnu packages linux) + #:use-module (gnu packages m4) + #:use-module (gnu packages maths) + #:use-module (gnu packages mpi) + #:use-module (gnu packages multiprecision) + #:use-module (gnu packages ncurses) + #:use-module (gnu packages readline) + #:use-module (gnu packages tls) + #:use-module (gnu packages version-control) + #:use-module (gnu packages xml) + #:use-module (gnu packages xorg) + #:use-module (guix download) + #:use-module (guix build utils) + #:use-module (guix build-system gnu) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (ice-9 ftw) + #:use-module (ice-9 regex) + #:use-module (srfi srfi-1)) + +(define-public openfoam + (package + (name "openfoam") + (version "4.1") + (source + (origin + (method url-fetch) + (uri (string-append + "http://dl.openfoam.org/source/" + (string-map (lambda (x) (if (eq? x #\.) #\- x)) version))) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 "1hgh2kw7fqv4bfachhbjhw16v8j35jbv6s576fmz4ka2q4ks4wg3")) + (patches (search-patches "openfoam-4.1-cleanup.patch")))) + (build-system gnu-build-system) + (inputs + `(("boost" ,boost) + ("cgal" ,cgal) + ("flex" ,flex) + ("git" ,git) + ("gmp" ,gmp) + ("libxt" ,libxt) + ("metis" ,metis) + ("mpfr" ,mpfr) + ("ncurses" ,ncurses) + ("readline" ,readline) + ("scotch" ,pt-scotch32) + ("zlib" ,zlib))) + (native-inputs + `(("bison" ,bison))) + (propagated-inputs + `(("gzip" ,gzip) + ("gnuplot" ,gnuplot) + ("openmpi" ,openmpi))) + (arguments + `(#:strip-directories (list (string-append + "OpenFOAM-" ,version + "/platforms/linux64GccDPInt32Opt/bin") + (string-append + "OpenFOAM-" ,version + "/platforms/linux64GccDPInt32Opt/lib")) + ; executable files and shared libraries are + ; located in the 'platforms' subdirectory + #:validate-runpath? #f ; '#:elf-directories' is not recognised here + #:tests? #f ; no tests to run + #:phases (modify-phases %standard-phases + (add-after 'unpack 'rename-build-directory + (lambda _ + (use-modules (ice-9 ftw)) + (use-modules (ice-9 regex)) + (chdir "..") + ;; use 'OpenFOAM-version' convention to match pathname expectations + ;; in the build phase + (let ((unpack-dir (string-append + (getcwd) "/" + (list-ref (scandir (getcwd) (lambda (name) + (string-match "^OpenFOAM" name))) 0))) + (build-dir (string-append + (getcwd) "/OpenFOAM-" ,version))) + (rename-file unpack-dir build-dir) ; re-name build directory + (chdir (basename build-dir))) ; move to build directory + #t)) + (add-after 'patch-source-shebangs 'set-environment-variables + (lambda _ + (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch"))) + ;; set variables to define store paths + (for-each (lambda (library) + (setenv (string-append + (string-upcase library) "_ROOT") + (assoc-ref %build-inputs library))) libraries)) + ;; set variables to define package versions + (setenv "SCOTCHVERSION" ,(package-version scotch)) + (setenv "METISVERSION" ,(package-version metis)) + #t)) + (delete 'configure) ; no configure phase + (replace 'build + (lambda _ + ;; compile OpenFOAM libraries and applications + (zero? (system (format #f + "source ./etc/bashrc && ./Allwmake -j~a" + (parallel-job-count)))))) + (add-after 'build 'update-configuration-files + (lambda _ + ;; record store paths and package versions in configuration files + (substitute* "etc/config.sh/CGAL" + (("$BOOST_ROOT") (getenv "BOOST_ROOT"))) + (substitute* "etc/config.sh/CGAL" + (("$CGAL_ROOT") (getenv "CGAL_ROOT"))) + (substitute* "etc/config.sh/metis" + (("$METIS_ROOT") (getenv "METIS_ROOT"))) + (substitute* "etc/config.sh/metis" + (("$METISVERSION") (getenv "METISVERSION"))) + (substitute* "etc/config.sh/scotch" + (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT"))) + (substitute* "etc/config.sh/scotch" + (("$SCOTCHVERSION") (getenv "SCOTCHVERSION"))) + (substitute* "etc/config.sh/settings" + (("$GMP_ROOT") (getenv "GMP_ROOT"))) + (substitute* "etc/config.sh/settings" + (("$MPFR_ROOT") (getenv "MPFR_ROOT"))) + ;; reset lockDir variable to refer to write-enabled directory + (substitute* "wmake/wmake" + ((" lockDir=.*$") + " lockDir=$HOME/.$WM_PROJECT/.wmake\n")) + (substitute* "wmake/wmakeScheduler" + (("lockDir=.*$") + "lockDir=$HOME/.$WM_PROJECT/.wmake\n")) + (substitute* "wmake/wmakeSchedulerUptime" + (("lockDir=.*$") + "lockDir=$HOME/.$WM_PROJECT/.wmake\n")) + #t)) + (replace 'install + (lambda _ + ;; use 'OpenFOAM-version' convention + (let ((install-dir (string-append + %output "/OpenFOAM-" ,version))) + (mkdir-p install-dir) ; create install directory + ;; move contents of build directory to install directory + (copy-recursively "." install-dir))))))) + ;; Note: tutorial files are installed read-only in /gnu/store. + ;; To allow write permissions on files copied from the store a + ;; 'chmod' step is needed before running the applications. For + ;; example, from a user's login: + ;; $ source $GUIX_PROFILE/OpenFOAM-4.1/etc/bashrc + ;; $ mkdir -p $FOAM_RUN + ;; $ cd $FOAM_RUN + ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzdaily . + ;; $ cd pitzdaily + ;; $ chmod -R u+w . + ;; $ blockMesh + (native-search-paths + ;; define the FOAM_INST_DIR variable + (list (search-path-specification + (variable "FOAM_INST_DIR") + (files '("."))))) + (synopsis "Framework for numerical simulation of fluid flow") + (description "OpenFOAM provides a set of solvers and methods for tackling +problems in the field of Computational Fluid Dynamics (CFD). It is written in +C++. Governing equations such as the Navier-Stokes equations can be solved in +integral form. Physical processes such as phase change, droplet transport and +chemical reaction can be modelled. Numerical methods are included to deal with +sharp gradients, such as those encountered in flows with shock waves and flows +with gas/liquid interfaces. Large problems may be split into smaller, connected +problems for efficient solution on parallel systems") + (license license:gpl3+) + (home-page "https://openfoam.org"))) -- 2.13.0 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-09-06 21:28 ` Paul Garlick @ 2017-09-07 11:57 ` Ludovic Courtès 0 siblings, 0 replies; 22+ messages in thread From: Ludovic Courtès @ 2017-09-07 11:57 UTC (permalink / raw) To: Paul Garlick; +Cc: 28045 [-- Attachment #1: Type: text/plain, Size: 791 bytes --] Hi Paul, I made the modifications below (mostly cosmetic) and built it locally. However, the resulting layout, with /OpenFOAM-4.1 at the root and essentially all the source tree beneath it, is unsatisfying. Would it be possible to follow a layout closer to what we usually do: /gnu/store/…-openfoam-4.1 bin/ lib/ share/ etc/ If the answer is “no”, or if that would take an unreasonable amount of work which should really be upstream’s job, then I can understand and we can make an exception. Or perhaps there’s a middle ground we could find? For instance, we install the tree to lib/openfoam-4.1, and then create bin/ as a symlink to lib/openfoam-4.1/platforms/linux64GccDPInt32Opt/bin? Would that work? Thank you! Ludo’. [-- Attachment #2: Type: text/x-patch, Size: 14877 bytes --] commit e334cc116c976aa13c5be61eedd895fb790fec83 Author: Ludovic Courtès <ludo@gnu.org> Date: Thu Sep 7 10:56:15 2017 +0200 openfoam fixlet diff --git a/gnu/packages/patches/openfoam-4.1-cleanup.patch b/gnu/packages/patches/openfoam-4.1-cleanup.patch index 590db5982..fc2107e0b 100644 --- a/gnu/packages/patches/openfoam-4.1-cleanup.patch +++ b/gnu/packages/patches/openfoam-4.1-cleanup.patch @@ -1,7 +1,7 @@ -# This patch removes all need for the ThirdParty files of OpenFOAM +# This patch removes all need for the ThirdParty files of OpenFOAM. -# Derived from easybuild patch: Ward Poelmans <wpoely86@gmail.com> -# Modified for GNU Guix: Paul Garlick <pgarlick@tourbillion-technology.com> +# Derived from EasyBuild patch by Ward Poelmans <wpoely86@gmail.com>. +# Modified for GNU Guix by Paul Garlick <pgarlick@tourbillion-technology.com>. diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake --- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake @@ -76,7 +76,7 @@ diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL OpenFOAM-4.x-version-4. diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools --- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools 2016-10-16 16:11:45.000000000 +0200 +++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools 2017-04-10 14:51:01.473221230 +0200 -@@ -29,13 +29,13 @@ +@@ -29,13 +29,5 @@ # #------------------------------------------------------------------------------ @@ -88,14 +88,6 @@ diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-vers - -export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH -export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH -+# version=svn -+# gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER -+# -+# GPERFTOOLS_VERSION=gperftools-$version -+# GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION -+# -+# export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH -+# export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH #------------------------------------------------------------------------------ diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-version-4.1/etc/config.sh/metis @@ -166,12 +158,11 @@ diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/o diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general --- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general +++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general -@@ -33,7 +33,7 @@ +@@ -33,7 +33,6 @@ # The Makefile uses a POSIX shell #------------------------------------------------------------------------------ -SHELL = /bin/sh -+# SHELL = /bin/sh #------------------------------------------------------------------------------ diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm index 3446d72c6..ff2aa69b6 100644 --- a/gnu/packages/simulation.scm +++ b/gnu/packages/simulation.scm @@ -56,14 +56,14 @@ (version "4.1") (source (origin - (method url-fetch) - (uri (string-append + (method url-fetch) + (uri (string-append "http://dl.openfoam.org/source/" (string-map (lambda (x) (if (eq? x #\.) #\- x)) version))) - (file-name (string-append name "-" version ".tar.gz")) - (sha256 - (base32 "1hgh2kw7fqv4bfachhbjhw16v8j35jbv6s576fmz4ka2q4ks4wg3")) - (patches (search-patches "openfoam-4.1-cleanup.patch")))) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 "1hgh2kw7fqv4bfachhbjhw16v8j35jbv6s576fmz4ka2q4ks4wg3")) + (patches (search-patches "openfoam-4.1-cleanup.patch")))) (build-system gnu-build-system) (inputs `(("boost" ,boost) @@ -85,106 +85,116 @@ ("gnuplot" ,gnuplot) ("openmpi" ,openmpi))) (arguments - `(#:strip-directories (list (string-append + `( ;; Executable files and shared libraries are located in the 'platforms' + ;; subdirectory. + #:strip-directories (list (string-append "OpenFOAM-" ,version "/platforms/linux64GccDPInt32Opt/bin") (string-append "OpenFOAM-" ,version "/platforms/linux64GccDPInt32Opt/lib")) - ; executable files and shared libraries are - ; located in the 'platforms' subdirectory - #:validate-runpath? #f ; '#:elf-directories' is not recognised here - #:tests? #f ; no tests to run - #:phases (modify-phases %standard-phases - (add-after 'unpack 'rename-build-directory - (lambda _ - (use-modules (ice-9 ftw)) - (use-modules (ice-9 regex)) - (chdir "..") - ;; use 'OpenFOAM-version' convention to match pathname expectations - ;; in the build phase - (let ((unpack-dir (string-append - (getcwd) "/" - (list-ref (scandir (getcwd) (lambda (name) - (string-match "^OpenFOAM" name))) 0))) - (build-dir (string-append - (getcwd) "/OpenFOAM-" ,version))) - (rename-file unpack-dir build-dir) ; re-name build directory - (chdir (basename build-dir))) ; move to build directory - #t)) - (add-after 'patch-source-shebangs 'set-environment-variables - (lambda _ - (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch"))) - ;; set variables to define store paths - (for-each (lambda (library) - (setenv (string-append - (string-upcase library) "_ROOT") - (assoc-ref %build-inputs library))) libraries)) - ;; set variables to define package versions - (setenv "SCOTCHVERSION" ,(package-version scotch)) - (setenv "METISVERSION" ,(package-version metis)) - #t)) - (delete 'configure) ; no configure phase - (replace 'build - (lambda _ - ;; compile OpenFOAM libraries and applications - (zero? (system (format #f - "source ./etc/bashrc && ./Allwmake -j~a" - (parallel-job-count)))))) - (add-after 'build 'update-configuration-files - (lambda _ - ;; record store paths and package versions in configuration files - (substitute* "etc/config.sh/CGAL" - (("$BOOST_ROOT") (getenv "BOOST_ROOT"))) - (substitute* "etc/config.sh/CGAL" - (("$CGAL_ROOT") (getenv "CGAL_ROOT"))) - (substitute* "etc/config.sh/metis" - (("$METIS_ROOT") (getenv "METIS_ROOT"))) - (substitute* "etc/config.sh/metis" - (("$METISVERSION") (getenv "METISVERSION"))) - (substitute* "etc/config.sh/scotch" - (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT"))) - (substitute* "etc/config.sh/scotch" - (("$SCOTCHVERSION") (getenv "SCOTCHVERSION"))) - (substitute* "etc/config.sh/settings" - (("$GMP_ROOT") (getenv "GMP_ROOT"))) - (substitute* "etc/config.sh/settings" - (("$MPFR_ROOT") (getenv "MPFR_ROOT"))) - ;; reset lockDir variable to refer to write-enabled directory - (substitute* "wmake/wmake" - ((" lockDir=.*$") - " lockDir=$HOME/.$WM_PROJECT/.wmake\n")) - (substitute* "wmake/wmakeScheduler" - (("lockDir=.*$") - "lockDir=$HOME/.$WM_PROJECT/.wmake\n")) - (substitute* "wmake/wmakeSchedulerUptime" - (("lockDir=.*$") - "lockDir=$HOME/.$WM_PROJECT/.wmake\n")) - #t)) - (replace 'install - (lambda _ - ;; use 'OpenFOAM-version' convention - (let ((install-dir (string-append - %output "/OpenFOAM-" ,version))) - (mkdir-p install-dir) ; create install directory - ;; move contents of build directory to install directory - (copy-recursively "." install-dir))))))) - ;; Note: tutorial files are installed read-only in /gnu/store. - ;; To allow write permissions on files copied from the store a - ;; 'chmod' step is needed before running the applications. For - ;; example, from a user's login: - ;; $ source $GUIX_PROFILE/OpenFOAM-4.1/etc/bashrc - ;; $ mkdir -p $FOAM_RUN - ;; $ cd $FOAM_RUN - ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzdaily . - ;; $ cd pitzdaily - ;; $ chmod -R u+w . - ;; $ blockMesh + #:validate-runpath? #f ; '#:elf-directories' is not recognised here + #:tests? #f ; no tests to run + + #:modules ((ice-9 ftw) + (ice-9 regex) + (guix build gnu-build-system) + (guix build utils)) + + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'rename-build-directory + (lambda _ + (chdir "..") + ;; Use 'OpenFOAM-version' convention to match file name + ;; expectations in the build phase. + (let ((unpack-dir (string-append + (getcwd) "/" + (car (scandir (getcwd) + (lambda (name) + (string-match "^OpenFOAM" + name)))))) + (build-dir (string-append + (getcwd) "/OpenFOAM-" ,version))) + (rename-file unpack-dir build-dir) ; re-name build directory + (chdir (basename build-dir)) ; move to build directory + #t))) + (add-after 'patch-source-shebangs 'set-environment-variables + (lambda _ + (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch"))) + ;; set variables to define store paths + (for-each (lambda (library) + (setenv (string-append + (string-upcase library) "_ROOT") + (assoc-ref %build-inputs library))) libraries)) + ;; set variables to define package versions + (setenv "SCOTCHVERSION" ,(package-version scotch)) + (setenv "METISVERSION" ,(package-version metis)) + #t)) + (delete 'configure) ; no configure phase + (replace 'build + (lambda _ + ;; compile OpenFOAM libraries and applications + (zero? (system (format #f + "source ./etc/bashrc && ./Allwmake -j~a" + (parallel-job-count)))))) + (add-after 'build 'update-configuration-files + (lambda _ + ;; record store paths and package versions in configuration files + (substitute* "etc/config.sh/CGAL" + (("$BOOST_ROOT") (getenv "BOOST_ROOT"))) + (substitute* "etc/config.sh/CGAL" + (("$CGAL_ROOT") (getenv "CGAL_ROOT"))) + (substitute* "etc/config.sh/metis" + (("$METIS_ROOT") (getenv "METIS_ROOT"))) + (substitute* "etc/config.sh/metis" + (("$METISVERSION") (getenv "METISVERSION"))) + (substitute* "etc/config.sh/scotch" + (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT"))) + (substitute* "etc/config.sh/scotch" + (("$SCOTCHVERSION") (getenv "SCOTCHVERSION"))) + (substitute* "etc/config.sh/settings" + (("$GMP_ROOT") (getenv "GMP_ROOT"))) + (substitute* "etc/config.sh/settings" + (("$MPFR_ROOT") (getenv "MPFR_ROOT"))) + ;; reset lockDir variable to refer to write-enabled directory + (substitute* "wmake/wmake" + ((" lockDir=.*$") + " lockDir=$HOME/.$WM_PROJECT/.wmake\n")) + (substitute* "wmake/wmakeScheduler" + (("lockDir=.*$") + "lockDir=$HOME/.$WM_PROJECT/.wmake\n")) + (substitute* "wmake/wmakeSchedulerUptime" + (("lockDir=.*$") + "lockDir=$HOME/.$WM_PROJECT/.wmake\n")) + #t)) + (replace 'install + (lambda _ + ;; use 'OpenFOAM-version' convention + (let ((install-dir (string-append + %output "/OpenFOAM-" ,version))) + (mkdir-p install-dir) ; create install directory + ;; move contents of build directory to install directory + (copy-recursively "." install-dir) + #t)))))) + + ;; Note: tutorial files are installed read-only in /gnu/store. + ;; To allow write permissions on files copied from the store a + ;; 'chmod' step is needed before running the applications. For + ;; example, from a user's login: + ;; $ source $GUIX_PROFILE/OpenFOAM-4.1/etc/bashrc + ;; $ mkdir -p $FOAM_RUN + ;; $ cd $FOAM_RUN + ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzdaily . + ;; $ cd pitzdaily + ;; $ chmod -R u+w . + ;; $ blockMesh (native-search-paths - ;; define the FOAM_INST_DIR variable + ;; Define the FOAM_INST_DIR variable. (list (search-path-specification (variable "FOAM_INST_DIR") - (files '("."))))) + (files '(".")) + (separator #f)))) ;single entry (synopsis "Framework for numerical simulation of fluid flow") (description "OpenFOAM provides a set of solvers and methods for tackling problems in the field of Computational Fluid Dynamics (CFD). It is written in ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam] 2017-08-11 11:06 ` [bug#28045] [PATCH] gnu: Add openfoam Paul Garlick 2017-08-14 23:07 ` Marius Bakke 2017-08-15 2:49 ` Eric Bavier @ 2017-09-07 22:41 ` Paul Garlick 2 siblings, 0 replies; 22+ messages in thread From: Paul Garlick @ 2017-09-07 22:41 UTC (permalink / raw) To: 28045 [-- Attachment #1: Type: text/plain, Size: 1792 bytes --] Hi Ludo, Thank you for your comments on the OpenFOAM layout. > > Would it be possible to follow a layout closer to what we usually do: There are some advantages of keeping the standard OpenFOAM layout, different though it is. Firstly, if it the layout remains upstream's responsibility it makes the Guix maintenance task simpler. Secondly, OpenFOAM users will immediately recognise the standard structure. > > Or perhaps there’s a middle ground we could find? Possibly but we would need to think of a way to avoid version clashes. One objective in packaging OpenFOAM for Guix is to allow users to have multiple versions of OpenFOAM installed at once. This is a common requirement in the OpenFOAM world since user development and upstream development are independent. However, it can be difficult to achieve, especially in a multi-user environment. Guix can offer an advantage over alternative methods of installation in this respect. To explain, imagine two OpenFOAM versions, A and B. If we use the OpenFOAM standard layout and install both with Guix we have: $GUIX_PROFILE/OpenFOAM-A /OpenFOAM-B A user might set up an alias to initialize the OpenFOAM environment variables for version A: $ alias startOFA='foamDotFile=$FOAM_INST_DIR/OpenFOAM-A/etc/bashrc; [ -f $foamDotFile ] && . $foamDotFile' Similarly, a 'startOFB' alias could be defined. The user could then choose the version for the particular task, or even use both versions simultaneously in separate shells. Could we achieve this versatility using a Guix-like layout? A possible problem might be executable files in version B clashing with executable files of the same name in version A, if they both share the $GUIX_PROFILE/bin directory. WDYT? Paul. [-- Attachment #2: Type: text/html, Size: 2051 bytes --] ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam [not found] <1504818378.3116.38.camel@tourbillion-technology.com> 2017-08-11 11:06 ` [bug#28045] [PATCH] gnu: Add openfoam Paul Garlick @ 2017-09-08 8:23 ` Ludovic Courtès 2017-09-08 11:32 ` Paul Garlick 1 sibling, 1 reply; 22+ messages in thread From: Ludovic Courtès @ 2017-09-08 8:23 UTC (permalink / raw) To: Paul Garlick; +Cc: 28045 Hi Paul, Paul Garlick <pgarlick@tourbillion-technology.com> skribis: >> Would it be possible to follow a layout closer to what we usually do: > > There are some advantages of keeping the standard OpenFOAM layout, > different though it is. Firstly, if it the layout remains upstream's > responsibility it makes the Guix maintenance task simpler. Secondly, > OpenFOAM users will immediately recognise the standard structure. OK, makes sense. >> Or perhaps there’s a middle ground we could find? > > Possibly but we would need to think of a way to avoid version clashes. > > > One objective in packaging OpenFOAM for Guix is to allow users to have > multiple versions of OpenFOAM installed at once. This is a common [...] > Could we achieve this versatility using a Guix-like layout? A possible > problem might be executable files in version B clashing with executable > files of the same name in version A, if they both share the > $GUIX_PROFILE/bin directory. If we provide a bin/ directory, then trying to install two different versions in the same profile will lead to a clash (and anyway, Guix raises an error when trying to install two different packages that have the same name in the same profile). However, Guix supports multiple profiles, so one can always do: guix package -i openfoam@1.2 -p old-openfoam guix package -i openfoam@2.0 -p new-openfoam ./old-openfoam/bin/openfoam ./new-openfoam/bin/openfoam Or, alternatively: $ guix environment --ad-hoc openfoam@3.4 [env]$ $GUIX_PROFILE/bin/… Does it address the use case you have in mind? That’s how we deal with conflicting package version requirements in the vast majority of cases. There are also some packages for which upstream’s build system explicitly supports “parallel installation” of different versions (Guile, Python, GLib, etc.). Thanks, Ludo’. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-09-08 8:23 ` [bug#28045] [PATCH] gnu: Add openfoam Ludovic Courtès @ 2017-09-08 11:32 ` Paul Garlick 2017-09-08 15:34 ` Eric Bavier 2017-09-08 15:39 ` [bug#28045] " Ludovic Courtès 0 siblings, 2 replies; 22+ messages in thread From: Paul Garlick @ 2017-09-08 11:32 UTC (permalink / raw) To: Ludovic Courtès; +Cc: 28045 Hi Ludo, > Does it address the use case you have in mind? Yes, I think that both the multiple-profile solution and the 'ad-hoc' environment will work for Guix/OpenFOAM. The traditional method of installing multiple OpenFOAM versions is to install to a common $FOAM_INST_DIR directory. However, as you point out, this is not strictly necessary and does not provide any advantage in the Guix system. So, continuing the 'middle road' line of thought, the 'install-dir' variable would be modified to add a '/lib' element: - %output "/OpenFOAM-" ,version))) + %output "/OpenFOAM-" ,version "/lib"))) You suggest adding a link between bin and lib/OpenFOAM- 4.1/platforms/linux64GccDPInt32Opt/bin. What would be the best way to add this to the package definition? There could also be a link between lib and lib/OpenFOAM- 4.1/platforms/linux64GccDPInt32Opt/lib. The links would allow the runpaths to be validated. So; - #:validate-runpath? #f ; '#:elf-directories' is not recognised here The FOAM_INST_DIR variable would need to be updated: - (files '("."))))) + (files '("./lib"))))) WDYT? Paul. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-09-08 11:32 ` Paul Garlick @ 2017-09-08 15:34 ` Eric Bavier 2017-09-08 20:30 ` Ludovic Courtès 2017-09-08 15:39 ` [bug#28045] " Ludovic Courtès 1 sibling, 1 reply; 22+ messages in thread From: Eric Bavier @ 2017-09-08 15:34 UTC (permalink / raw) To: Paul Garlick; +Cc: 28045 ----- Original Message ----- > Hi Ludo, > > > > Does it address the use case you have in mind? > > Yes, I think that both the multiple-profile solution and the 'ad-hoc' > environment will work for Guix/OpenFOAM. > > The traditional method of installing multiple OpenFOAM versions is to > install to a common $FOAM_INST_DIR directory. However, as you point > out, this is not strictly necessary and does not provide any > advantage > in the Guix system. > > So, continuing the 'middle road' line of thought, the 'install-dir' > variable would be modified to add a '/lib' element: > > - %output "/OpenFOAM-" ,version))) > + %output "/OpenFOAM-" ,version > "/lib"))) > > You suggest adding a link between bin and lib/OpenFOAM- > 4.1/platforms/linux64GccDPInt32Opt/bin. What would be the best way > to > add this to the package definition? > > There could also be a link between lib and lib/OpenFOAM- > 4.1/platforms/linux64GccDPInt32Opt/lib. > > The links would allow the runpaths to be validated. So; > > - #:validate-runpath? #f ; '#:elf-directories' is not > recognised > here > > The FOAM_INST_DIR variable would need to be updated: > > - (files '("."))))) > + (files '("./lib"))))) > > WDYT?> It seems to me that if using Guix's profiles and environments, we could entirely do without OpenFOAM's installation directories and simply install into a standard bin/lib structure. Just install libraries into (string-append %output "/lib") and the binaries into (string-append %output "/bin"). `~Eric ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-09-08 15:34 ` Eric Bavier @ 2017-09-08 20:30 ` Ludovic Courtès 2017-09-11 9:18 ` Paul Garlick 0 siblings, 1 reply; 22+ messages in thread From: Ludovic Courtès @ 2017-09-08 20:30 UTC (permalink / raw) To: Eric Bavier; +Cc: 28045, Paul Garlick Hi Eric, Eric Bavier <ericbavier@centurylink.net> skribis: > It seems to me that if using Guix's profiles and environments, we could entirely do without OpenFOAM's installation directories and simply install into a standard bin/lib structure. Just install libraries into (string-append %output "/lib") and the binaries into (string-append %output "/bin"). Fair enough. I guess the question is more whether (1) this would work :-), and (2) whether seasoned OpenFOAM users would be happy with this. WDYT, Paul? Ludo’. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-09-08 20:30 ` Ludovic Courtès @ 2017-09-11 9:18 ` Paul Garlick 2017-09-11 11:39 ` Ludovic Courtès 0 siblings, 1 reply; 22+ messages in thread From: Paul Garlick @ 2017-09-11 9:18 UTC (permalink / raw) To: Ludovic Courtès, Eric Bavier; +Cc: 28045 [-- Attachment #1: Type: text/plain, Size: 1907 bytes --] Hi Ludo and Eric, I think it is helpful to consider this question in two ways; thinking about the short term and the longer term. I think in the short term it is best to stick with the OpenFOAM-standard layout, modified in the 'middle-road' way suggested earlier. On top of the previous points made, there is an additional advantage to this approach in that the OpenFOAM-standard layout has been thoroughly tested in production use over many years. In the longer term I think it would be possible to develop a Guix- standard layout. I cannot see any reason why this would not work. However, with a large system such as OpenFOAM, this may not necessarily be an easy task. I see this as principally an upstream job, since they are the most knowledgeable people on the current layout and are best placed to deal with any subleties involved. With a working Guix package in place it will be a good time to contact upstream and discuss the merits of a new layout. Today I hope to finish the package definition. I have placed the tree under the 'lib' directory and this allows the 'validate-runpath' phase to run. The phase currently fails as ld-wrapper does not add the runpaths of the shared objects in the build tree. I plan to use patchelf to fix this. Paul. On Fri, 2017-09-08 at 22:30 +0200, Ludovic Courtès wrote: > Hi Eric, > > Eric Bavier <ericbavier@centurylink.net> skribis: > > > > > It seems to me that if using Guix's profiles and environments, we > > could entirely do without OpenFOAM's installation directories and > > simply install into a standard bin/lib structure. Just install > > libraries into (string-append %output "/lib") and the binaries into > > (string-append %output "/bin"). > Fair enough. I guess the question is more whether (1) this would > work > :-), and (2) whether seasoned OpenFOAM users would be happy with > this. > > WDYT, Paul? > > Ludo’. [-- Attachment #2: Type: text/html, Size: 2250 bytes --] ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-09-11 9:18 ` Paul Garlick @ 2017-09-11 11:39 ` Ludovic Courtès 2017-09-14 15:46 ` Paul Garlick 0 siblings, 1 reply; 22+ messages in thread From: Ludovic Courtès @ 2017-09-11 11:39 UTC (permalink / raw) To: Paul Garlick; +Cc: 28045 Hi Paul, Paul Garlick <pgarlick@tourbillion-technology.com> skribis: > I think it is helpful to consider this question in two ways; thinking about the short term and the longer term. I think in the short term it is best to stick with the OpenFOAM-standard layout, modified in the 'middle-road' way suggested > earlier. On top of the previous points made, there is an additional advantage to this approach in that the OpenFOAM-standard layout has been thoroughly tested in production use over many years. > > In the longer term I think it would be possible to develop a Guix-standard layout. I cannot see any reason why this would not work. However, with a large system such as OpenFOAM, this may not necessarily be an easy task. I see this > as principally an upstream job, since they are the most knowledgeable people on the current layout and are best placed to deal with any subleties involved. With a working Guix package in place it will be a good time to contact > upstream and discuss the merits of a new layout. I agree. So for now, I’d say go with the bin/ symlink, and then start a discussion with upstream to see how to improve things in the future. > Today I hope to finish the package definition. I have placed the tree under the 'lib' directory and this allows the 'validate-runpath' phase to run. The phase currently fails as ld-wrapper does not add the runpaths of the shared objects in > the build tree. I plan to use patchelf to fix this. I would refrain from using PatchELF, if possible, by just passing -Wl,-rpath=DIR at link time, where DIR is the final library directory. Ludo’. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-09-11 11:39 ` Ludovic Courtès @ 2017-09-14 15:46 ` Paul Garlick 2017-09-15 16:35 ` bug#28045: " Ludovic Courtès 0 siblings, 1 reply; 22+ messages in thread From: Paul Garlick @ 2017-09-14 15:46 UTC (permalink / raw) To: ludo; +Cc: 28045, Paul Garlick *gnu/packages/patches/openfoam-4.1-cleanup.patch: New file *gnu/packages/simulation.scm: New file *gnu/local.mk (GNU_SYSTEM_MODULES): Add module (dist_patch_DATA): Add patch --- Hi Ludo, > I would refrain from using PatchELF, if possible, by just passing > -Wl,-rpath=DIR at link time, where DIR is the final library directory. OK, no need for PatchELF. I used the variable LDFLAGS to pass the extra arguments to the linker. A change was needed in the 'wmake/rules/linux64Gcc/c++' file to make use of the extra variable. An additional change was needed in the 'wmake/rules/General/CGAL' file to add an entry for the gmp library (referenced by one binary and one shared library). The runpath addition for gmp is taken care of by ld-wrapper. The validate-runpath phase now passes and the build succeeds. > I really dislike this FOAM_INST_DIR variable I took another look at this question. As it turns out, from OpenFOAM version 4.1 onwards this variable is set automatically. A user simply sources the bashrc file, as detailed in the Note, and the correct path is set. So we can dispense with this section after all. Also, I have merged the 'set-environment-variables' phase and the 'build' phase as there is no need for separate phases. Paul. gnu/local.mk | 2 + gnu/packages/patches/openfoam-4.1-cleanup.patch | 243 ++++++++++++++++++++++++ gnu/packages/simulation.scm | 206 ++++++++++++++++++++ 3 files changed, 451 insertions(+) create mode 100644 gnu/packages/patches/openfoam-4.1-cleanup.patch create mode 100644 gnu/packages/simulation.scm diff --git a/gnu/local.mk b/gnu/local.mk index 643a88db8..048f7aa1c 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -363,6 +363,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/shells.scm \ %D%/packages/shellutils.scm \ %D%/packages/simh.scm \ + %D%/packages/simulation.scm \ %D%/packages/skarnet.scm \ %D%/packages/skribilo.scm \ %D%/packages/slang.scm \ @@ -886,6 +887,7 @@ dist_patch_DATA = \ %D%/packages/patches/ola-readdir-r.patch \ %D%/packages/patches/openscenegraph-ffmpeg3.patch \ %D%/packages/patches/openexr-missing-samples.patch \ + %D%/packages/patches/openfoam-4.1-cleanup.patch \ %D%/packages/patches/openjpeg-CVE-2017-12982.patch \ %D%/packages/patches/openjpeg-CVE-2017-14040.patch \ %D%/packages/patches/openjpeg-CVE-2017-14041.patch \ diff --git a/gnu/packages/patches/openfoam-4.1-cleanup.patch b/gnu/packages/patches/openfoam-4.1-cleanup.patch new file mode 100644 index 000000000..37effa5c9 --- /dev/null +++ b/gnu/packages/patches/openfoam-4.1-cleanup.patch @@ -0,0 +1,243 @@ +# This patch removes all need for the ThirdParty files of OpenFOAM. + +# Derived from EasyBuild patch by Ward Poelmans <wpoely86@gmail.com>. +# Modified for GNU Guix by Paul Garlick <pgarlick@tourbillion-technology.com>. + +diff -ur OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake +--- OpenFOAM-4.x-version-4.1.org/applications/utilities/mesh/manipulation/setSet/Allwmake ++++ OpenFOAM-4.x-version-4.1/applications/utilities/mesh/manipulation/setSet/Allwmake +@@ -9,7 +9,7 @@ + # + # use readline if available + # +-if [ -f /usr/include/readline/readline.h ] ++if true + then + echo "Found <readline/readline.h> -- enabling readline support." + export COMP_FLAGS="-DHAS_READLINE" +diff -ur OpenFOAM-4.x-version-4.1.org/etc/bashrc OpenFOAM-4.x-version-4.1/etc/bashrc +--- OpenFOAM-4.x-version-4.1.org/etc/bashrc ++++ OpenFOAM-4.x-version-4.1/etc/bashrc +@@ -43,8 +43,10 @@ + # Please set to the appropriate path if the default is not correct. + # + [ $BASH_SOURCE ] && \ +-export FOAM_INST_DIR=$(cd ${BASH_SOURCE%/*/*/*} && pwd -P) || \ ++export FOAM_INST_DIR=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P) || \ + export FOAM_INST_DIR=$HOME/$WM_PROJECT ++# For GNU Guix: set initially for build then re-set at runtime ++# + # export FOAM_INST_DIR=~$WM_PROJECT + # export FOAM_INST_DIR=/opt/$WM_PROJECT + # export FOAM_INST_DIR=/usr/local/$WM_PROJECT +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/CGAL ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/CGAL +@@ -36,37 +36,7 @@ + # + #------------------------------------------------------------------------------ + +-boost_version=boost-system +-cgal_version=cgal-system +-#cgal_version=CGAL-4.8 +- +-if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ] +-then +- +- common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER +- +- export BOOST_ARCH_PATH=$common_path/$boost_version +- export CGAL_ARCH_PATH=$common_path/$cgal_version +- +- if [ "$FOAM_VERBOSE" -a "$PS1" ] +- then +- echo "Using CGAL and boost" 1>&2 +- echo " $cgal_version at $CGAL_ARCH_PATH" 1>&2 +- echo " $boost_version at $BOOST_ARCH_PATH" 1>&2 +- fi +- +- if [ -d "$CGAL_ARCH_PATH" -a "$cgal_version" != "cgal-system" ] +- then +- _foamAddLib $CGAL_ARCH_PATH/lib +- fi +- +- if [ -d "$BOOST_ARCH_PATH" -a "$boost_version" != "boost-system" ] +- then +- _foamAddLib $BOOST_ARCH_PATH/lib +- fi +- +- unset boost_version cgal_version common_path +- +-fi ++export CGAL_ARCH_PATH=$CGAL_ROOT ++export BOOST_ARCH_PATH=$BOOST_ROOT + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/gperftools ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/gperftools +@@ -29,13 +29,5 @@ + # + #------------------------------------------------------------------------------ + +-version=svn +-gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER +- +-GPERFTOOLS_VERSION=gperftools-$version +-GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION +- +-export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH +-export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis OpenFOAM-4.x-version-4.1/etc/config.sh/metis +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/metis ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/metis +@@ -34,7 +34,7 @@ + # + #------------------------------------------------------------------------------ + +-export METIS_VERSION=metis-5.1.0 +-export METIS_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$METIS_VERSION ++export METIS_VERSION=metis-$METISVERSION ++export METIS_ARCH_PATH=$METIS_ROOT + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch OpenFOAM-4.x-version-4.1/etc/config.sh/scotch +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/scotch ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/scotch +@@ -37,7 +37,7 @@ + # + #------------------------------------------------------------------------------ + +-export SCOTCH_VERSION=scotch_6.0.3 +-export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION ++export SCOTCH_VERSION=scotch_$SCOTCHVERSION ++export SCOTCH_ARCH_PATH=$SCOTCH_ROOT + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings OpenFOAM-4.x-version-4.1/etc/config.sh/settings +--- OpenFOAM-4.x-version-4.1.org/etc/config.sh/settings ++++ OpenFOAM-4.x-version-4.1/etc/config.sh/settings +@@ -279,6 +279,9 @@ + ;; + system) + # Use system compiler ++ # Use system GMP and MPFR packages ++ export GMP_ARCH_PATH=$GMP_ROOT ++ export MPFR_ARCH_PATH=$MPFR_ROOT + ;; + *) + echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2 +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/ptscotchDecomp/Make/options ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/ptscotchDecomp/Make/options +@@ -5,8 +5,7 @@ + $(PFLAGS) $(PINC) \ + -I$(SCOTCH_ROOT)/include \ + -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \ +- -I/usr/include/scotch \ + -I../decompositionMethods/lnInclude + + LIB_LIBS = \ +- -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt ++ -L$(SCOTCH_ROOT)/lib -L$(MPI_ARCH_PATH)/lib -lptscotch -lptscotcherrexit -lscotch ${LINK_FLAGS} -lrt +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/scotchDecomp/Make/options ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/scotchDecomp/Make/options +@@ -9,8 +9,7 @@ + $(PFLAGS) $(PINC) \ + -I$(SCOTCH_ROOT)/include \ + -I$(SCOTCH_ARCH_PATH)/include \ +- -I/usr/include/scotch \ + -I../decompositionMethods/lnInclude + + LIB_LIBS = \ +- -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt ++ -L$(SCOTCH_ROOT)/lib -lscotch -lscotcherrexit -lrt +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general OpenFOAM-4.x-version-4.1/wmake/makefiles/general +--- OpenFOAM-4.x-version-4.1.org/wmake/makefiles/general ++++ OpenFOAM-4.x-version-4.1/wmake/makefiles/general +@@ -33,7 +33,6 @@ + # The Makefile uses a POSIX shell + #------------------------------------------------------------------------------ + +-SHELL = /bin/sh + + + #------------------------------------------------------------------------------ +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmake OpenFOAM-4.x-version-4.1/wmake/wmake +--- OpenFOAM-4.x-version-4.1.org/wmake/wmake ++++ OpenFOAM-4.x-version-4.1/wmake/wmake +@@ -163,7 +163,7 @@ + then + if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ] + then +- lockDir=$HOME/.$WM_PROJECT/.wmake ++ lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake + + if [ -d $lockDir ] + then +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler +--- OpenFOAM-4.x-version-4.1.org/wmake/wmakeScheduler ++++ OpenFOAM-4.x-version-4.1/wmake/wmakeScheduler +@@ -53,7 +53,7 @@ + # csh sets HOST, bash sets HOSTNAME + : ${HOST:=$HOSTNAME} + +-lockDir=$HOME/.$WM_PROJECT/.wmake ++lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake + + # Fallback - 1 core on current host + : ${WM_HOSTS:=$HOST:1} +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime +--- OpenFOAM-4.x-version-4.1.org/wmake/wmakeSchedulerUptime ++++ OpenFOAM-4.x-version-4.1/wmake/wmakeSchedulerUptime +@@ -53,7 +53,7 @@ + # csh sets HOST, bash sets HOSTNAME + : ${HOST:=$HOSTNAME} + +-lockDir=$HOME/.$WM_PROJECT/.wmake ++lockDir=$(cd $(dirname $BASH_SOURCE)/../.. && pwd -P)/.$WM_PROJECT/.wmake + # Fallback - 1 core on current host + : ${WM_HOSTS:=$HOST:1} + +diff -ur OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C +--- OpenFOAM-4.x-version-4.1.org/src/parallel/decompose/metisDecomp/metisDecomp.C ++++ OpenFOAM-4.x-version-4.1/src/parallel/decompose/metisDecomp/metisDecomp.C +@@ -67,7 +67,7 @@ + + // Processor weights initialised with no size, only used if specified in + // a file +- Field<scalar> processorWeights; ++ Field<floatScalar> processorWeights; + + // Cell weights (so on the vertices of the dual) + List<label> cellWeights; +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL +--- OpenFOAM-4.x-version-4.1.org/wmake/rules/General/CGAL ++++ OpenFOAM-4.x-version-4.1/wmake/rules/General/CGAL +@@ -6,9 +6,10 @@ + -I/usr/include + + CGAL_LIBS = \ +- -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ +- -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \ ++ -L$(MPFR_ARCH_PATH)/lib \ ++ -L$(GMP_ARCH_PATH)/lib \ + -L$(BOOST_ARCH_PATH)/lib \ + -L$(CGAL_ARCH_PATH)/lib \ + -lCGAL \ ++ -lgmp \ + -lmpfr +diff -ur OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++ +--- OpenFOAM-4.x-version-4.1.org/wmake/rules/linux64Gcc/c++ ++++ OpenFOAM-4.x-version-4.1/wmake/rules/linux64Gcc/c++ +@@ -20,5 +20,5 @@ + + LINK_LIBS = $(c++DBUG) + +-LINKLIBSO = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed +-LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed ++LINKLIBSO = $(CC) $(c++FLAGS) $(LDFLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed ++LINKEXE = $(CC) $(c++FLAGS) $(LDFLAGS) -Xlinker --add-needed -Xlinker --no-as-needed diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm new file mode 100644 index 000000000..cc80dbb41 --- /dev/null +++ b/gnu/packages/simulation.scm @@ -0,0 +1,206 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com> +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. + +(define-module (gnu packages simulation) + #:use-module (gnu packages) + #:use-module (gnu packages base) + #:use-module (gnu packages bash) + #:use-module (gnu packages bison) + #:use-module (gnu packages boost) + #:use-module (gnu packages compression) + #:use-module (gnu packages flex) + #:use-module (gnu packages gettext) + #:use-module (gnu packages gcc) + #:use-module (gnu packages gl) + #:use-module (gnu packages graphics) + #:use-module (gnu packages gtk) + #:use-module (gnu packages linux) + #:use-module (gnu packages m4) + #:use-module (gnu packages maths) + #:use-module (gnu packages mpi) + #:use-module (gnu packages multiprecision) + #:use-module (gnu packages ncurses) + #:use-module (gnu packages readline) + #:use-module (gnu packages tls) + #:use-module (gnu packages version-control) + #:use-module (gnu packages xml) + #:use-module (gnu packages xorg) + #:use-module (guix download) + #:use-module (guix build utils) + #:use-module (guix build-system gnu) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (ice-9 ftw) + #:use-module (ice-9 regex) + #:use-module (srfi srfi-1)) + +(define-public openfoam + (package + (name "openfoam") + (version "4.1") + (source + (origin + (method url-fetch) + (uri (string-append + "http://dl.openfoam.org/source/" + (string-map (lambda (x) (if (eq? x #\.) #\- x)) version))) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 "0cgxh4h2hf50qbvvdg5miwc2nympb0nrv3md96vb3gbs9vk8vq9d")) + (patches (search-patches "openfoam-4.1-cleanup.patch")))) + (build-system gnu-build-system) + (inputs + `(("boost" ,boost) + ("cgal" ,cgal) + ("flex" ,flex) + ("git" ,git) + ("gmp" ,gmp) + ("libxt" ,libxt) + ("metis" ,metis) + ("mpfr" ,mpfr) + ("ncurses" ,ncurses) + ("readline" ,readline) + ("scotch" ,pt-scotch32) + ("zlib" ,zlib))) + (native-inputs + `(("bison" ,bison))) + (propagated-inputs + `(("gzip" ,gzip) + ("gnuplot" ,gnuplot) + ("openmpi" ,openmpi))) + (arguments + `(;; Executable files and shared libraries are located in the 'platforms' + ;; subdirectory. + #:strip-directories (list (string-append + "lib/OpenFOAM-" ,version + "/platforms/linux64GccDPInt32Opt/bin") + (string-append + "lib/OpenFOAM-" ,version + "/platforms/linux64GccDPInt32Opt/lib")) + #:tests? #f ; no tests to run + #:phases (modify-phases %standard-phases + (add-after 'unpack 'rename-build-directory + (lambda _ + (use-modules (ice-9 ftw)) + (use-modules (ice-9 regex)) + (chdir "..") + ;; use 'OpenFOAM-version' convention to match pathname expectations + ;; in the build phase + (let ((unpack-dir (string-append + (getcwd) "/" + (list-ref (scandir (getcwd) (lambda (name) + (string-match "^OpenFOAM" name))) 0))) + (build-dir (string-append + (getcwd) "/OpenFOAM-" ,version))) + (rename-file unpack-dir build-dir) ; re-name build directory + (chdir (basename build-dir))) ; move to build directory + #t)) + (delete 'configure) ; no configure phase + (replace 'build + (lambda _ + (let ((libraries '("boost" "cgal" "gmp" "metis" "mpfr" "scotch"))) + ;; set variables to define store paths + (for-each (lambda (library) + (setenv (string-append + (string-upcase library) "_ROOT") + (assoc-ref %build-inputs library))) libraries)) + ;; set variables to define package versions + (setenv "SCOTCHVERSION" ,(package-version scotch)) + (setenv "METISVERSION" ,(package-version metis)) + ;; set variable to pass extra 'rpath' arguments to linker + (setenv "LDFLAGS" + (string-append + "-Wl," + "-rpath=" %output "/lib/OpenFOAM-" ,version + "/platforms/linux64GccDPInt32Opt/lib," + "-rpath=" %output "/lib/OpenFOAM-" ,version + "/platforms/linux64GccDPInt32Opt/lib/dummy")) + ;; compile OpenFOAM libraries and applications + (zero? (system (format #f + "source ./etc/bashrc && ./Allwmake -j~a" + (parallel-job-count)))))) + (add-after 'build 'update-configuration-files + (lambda _ + ;; record store paths and package versions in configuration files + (substitute* "etc/config.sh/CGAL" + (("$BOOST_ROOT") (getenv "BOOST_ROOT"))) + (substitute* "etc/config.sh/CGAL" + (("$CGAL_ROOT") (getenv "CGAL_ROOT"))) + (substitute* "etc/config.sh/metis" + (("$METIS_ROOT") (getenv "METIS_ROOT"))) + (substitute* "etc/config.sh/metis" + (("$METISVERSION") (getenv "METISVERSION"))) + (substitute* "etc/config.sh/scotch" + (("$SCOTCH_ROOT") (getenv "SCOTCH_ROOT"))) + (substitute* "etc/config.sh/scotch" + (("$SCOTCHVERSION") (getenv "SCOTCHVERSION"))) + (substitute* "etc/config.sh/settings" + (("$GMP_ROOT") (getenv "GMP_ROOT"))) + (substitute* "etc/config.sh/settings" + (("$MPFR_ROOT") (getenv "MPFR_ROOT"))) + ;; reset lockDir variable to refer to write-enabled directory + (substitute* "wmake/wmake" + ((" lockDir=.*$") + " lockDir=$HOME/.$WM_PROJECT/.wmake\n")) + (substitute* "wmake/wmakeScheduler" + (("lockDir=.*$") + "lockDir=$HOME/.$WM_PROJECT/.wmake\n")) + (substitute* "wmake/wmakeSchedulerUptime" + (("lockDir=.*$") + "lockDir=$HOME/.$WM_PROJECT/.wmake\n")) + #t)) + (replace 'install + (lambda _ + ;; use 'OpenFOAM-version' convention + (let ((install-dir (string-append + %output "/lib/OpenFOAM-" ,version))) + (mkdir-p install-dir) ; create install directory + ;; move contents of build directory to install directory + (copy-recursively "." install-dir)))) + (add-after 'install 'add-symbolic-link + (lambda _ + ;; add symbolic link for standard 'bin' directory + (symlink + (string-append "./lib/OpenFOAM-" ,version + "/platforms/linux64GccDPInt32Opt/bin") + (string-append %output "/bin")) + #t))))) + ;; Note: + ;; Tutorial files are installed read-only in /gnu/store. + ;; To allow write permissions on files copied from the store a + ;; 'chmod' step is needed before running the applications. For + ;; example, from a user's login: + ;; $ source $GUIX_PROFILE/lib/OpenFOAM-4.1/etc/bashrc + ;; $ mkdir -p $FOAM_RUN + ;; $ cd $FOAM_RUN + ;; $ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzdaily . + ;; $ cd pitzdaily + ;; $ chmod -R u+w . + ;; $ blockMesh + (synopsis "Framework for numerical simulation of fluid flow") + (description "OpenFOAM provides a set of solvers and methods for tackling +problems in the field of Computational Fluid Dynamics (CFD). It is written in +C++. Governing equations such as the Navier-Stokes equations can be solved in +integral form. Physical processes such as phase change, droplet transport and +chemical reaction can be modelled. Numerical methods are included to deal with +sharp gradients, such as those encountered in flows with shock waves and flows +with gas/liquid interfaces. Large problems may be split into smaller, connected +problems for efficient solution on parallel systems") + (license license:gpl3+) + (home-page "https://openfoam.org"))) -- 2.13.0 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* bug#28045: [PATCH] gnu: Add openfoam 2017-09-14 15:46 ` Paul Garlick @ 2017-09-15 16:35 ` Ludovic Courtès 0 siblings, 0 replies; 22+ messages in thread From: Ludovic Courtès @ 2017-09-15 16:35 UTC (permalink / raw) To: Paul Garlick; +Cc: 28045-done Hi Paul, Paul Garlick <pgarlick@tourbillion-technology.com> skribis: > *gnu/packages/patches/openfoam-4.1-cleanup.patch: New file > *gnu/packages/simulation.scm: New file > *gnu/local.mk (GNU_SYSTEM_MODULES): Add module > (dist_patch_DATA): Add patch I went ahead and pushed this (with indentation changes and use of #:modules as discussed earlier; please consider using ‘etc/indent-code.el’ in the future): https://git.savannah.gnu.org/cgit/guix.git/commit/?id=8f21aa22bf4b731ed0e5631c371846028e5cec0d Users who don’t set FOAM_INST_DIR will be tripped up like this: --8<---------------cut here---------------start------------->8--- $ /gnu/store/4zqn4w0wlq0irdwh3dhrdbsr7i3f1dag-openfoam-4.1/bin/checkMesh --> FOAM FATAL ERROR in Foam::findEtcFiles() : could not find mandatory file 'controlDict' $ /gnu/store/4zqn4w0wlq0irdwh3dhrdbsr7i3f1dag-openfoam-4.1/bin/interFoam --> FOAM FATAL ERROR in Foam::findEtcFiles() : could not find mandatory file 'controlDict' --8<---------------cut here---------------end--------------->8--- But that’s part of the game for now. :-) Thanks a lot for your work and patience! Ludo’. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [bug#28045] [PATCH] gnu: Add openfoam 2017-09-08 11:32 ` Paul Garlick 2017-09-08 15:34 ` Eric Bavier @ 2017-09-08 15:39 ` Ludovic Courtès 1 sibling, 0 replies; 22+ messages in thread From: Ludovic Courtès @ 2017-09-08 15:39 UTC (permalink / raw) To: Paul Garlick; +Cc: 28045 Hi Paul, Paul Garlick <pgarlick@tourbillion-technology.com> skribis: >> Does it address the use case you have in mind? > > Yes, I think that both the multiple-profile solution and the 'ad-hoc' > environment will work for Guix/OpenFOAM. Good! > So, continuing the 'middle road' line of thought, the 'install-dir' > variable would be modified to add a '/lib' element: > > - %output "/OpenFOAM-" ,version))) > + %output "/OpenFOAM-" ,version > "/lib"))) Sounds good. > You suggest adding a link between bin and lib/OpenFOAM- > 4.1/platforms/linux64GccDPInt32Opt/bin. What would be the best way to > add this to the package definition? Perhaps adding an extra phase at the end that simply calls ‘symlink’? > There could also be a link between lib and lib/OpenFOAM- > 4.1/platforms/linux64GccDPInt32Opt/lib. Yes. > The links would allow the runpaths to be validated. So; > > - #:validate-runpath? #f ; '#:elf-directories' is not recognised > here That’d be great. If that phase errors out, it probably means that the binaries won’t work out of the box, so it’s good to fix it. (BTW, please note that executables should go to bin/, libraries and other architecture-dependent files to lib/, and share/ is for architecture-independent stuff. I suppose we’ll only have bin/ and lib/ for a start, that’s OK.) > The FOAM_INST_DIR variable would need to be updated: > > - (files '("."))))) > + (files '("./lib"))))) I really dislike this FOAM_INST_DIR variable (usually packages “know” where they are installed and don’t need an extra variable for that), but if it has to be there, then so be it. :-) I think we should be all set? I’ll wait for your hopefully last patch revision! Besides, for the future, if you have an opportunity to discuss these matters with upstream, I’d recommend suggesting the addition of a proper installation phase (“make install”), and also support at least for an installation prefix, and ideally for more directory categories (see <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>). Thanks for your patience! Ludo’. ^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2017-09-15 16:36 UTC | newest] Thread overview: 22+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1504818378.3116.38.camel@tourbillion-technology.com> 2017-08-11 11:06 ` [bug#28045] [PATCH] gnu: Add openfoam Paul Garlick 2017-08-14 23:07 ` Marius Bakke 2017-08-15 2:49 ` Eric Bavier 2017-08-16 17:52 ` Paul Garlick 2017-08-16 20:04 ` Eric Bavier 2017-08-17 9:42 ` Paul Garlick 2017-08-22 13:02 ` Ludovic Courtès 2017-08-22 17:10 ` Paul Garlick 2017-08-22 22:33 ` Ludovic Courtès 2017-08-30 15:08 ` Paul Garlick 2017-09-06 21:28 ` Paul Garlick 2017-09-07 11:57 ` Ludovic Courtès 2017-09-07 22:41 ` [bug#28045] [PATCH] gnu: Add openfoam] Paul Garlick 2017-09-08 8:23 ` [bug#28045] [PATCH] gnu: Add openfoam Ludovic Courtès 2017-09-08 11:32 ` Paul Garlick 2017-09-08 15:34 ` Eric Bavier 2017-09-08 20:30 ` Ludovic Courtès 2017-09-11 9:18 ` Paul Garlick 2017-09-11 11:39 ` Ludovic Courtès 2017-09-14 15:46 ` Paul Garlick 2017-09-15 16:35 ` bug#28045: " Ludovic Courtès 2017-09-08 15:39 ` [bug#28045] " Ludovic Courtès
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.