From ac008a3ca0b47605e4bcdb2f937a8bb96a35a2bb Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Fri, 5 Jul 2013 18:15:23 +0200 Subject: [PATCH] Compatibility: auto NCOMPPROCS for Mac --- etc/bashrc | 15 ++++++++++++++- etc/cshrc | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/etc/bashrc b/etc/bashrc index e829b6e14..745affcbd 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -128,7 +128,6 @@ export WM_COMPILER_LIB_ARCH= # Compilation options (architecture, precision, optimised, debug or profiling) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -: ${WM_NCOMPPROCS:=`grep -c processor /proc/cpuinfo`}; export WM_NCOMPPROCS # WM_ARCH_OPTION = 32 | 64 : ${WM_ARCH_OPTION:=64}; export WM_ARCH_OPTION @@ -142,6 +141,20 @@ export WM_COMPILER_LIB_ARCH= # WM_MPLIB = | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI : ${WM_MPLIB:=OPENMPI}; export WM_MPLIB +# WM_NCOMPPROCS = +if [ -z "${WM_NCOMPPROCS+xxx}" ] +then + case `uname -s` in + Linux) + export WM_NCOMPPROCS=`grep -c processor /proc/cpuinfo` + ;; + + Darwin) + export WM_NCOMPPROCS=`sysctl -n hw.ncpu` + ;; + esac +fi + # Run options (floating-point signal handling and memory initialisation) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/etc/cshrc b/etc/cshrc index f408acb5b..52a48db48 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -119,8 +119,6 @@ setenv WM_COMPILER_LIB_ARCH # Compilation options (architecture, precision, optimised, debug or profiling) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -if ( ! $?WM_NCOMPPROCS ) setenv WM_NCOMPPROCS=`grep -c processor /proc/cpuinfo` - # WM_ARCH_OPTION = 32 | 64 if ( ! $?WM_ARCH_OPTION ) setenv WM_ARCH_OPTION 64 @@ -135,6 +133,20 @@ if ( ! $?WM_COMPILE_OPTION ) setenv WM_COMPILE_OPTION Opt # WM_MPLIB = | OPENMPI | MPICH | MPICH-GM | HPMPI | GAMMA | MPI | QSMPI if ( ! $?WM_MPLIB ) setenv WM_MPLIB OPENMPI +# WM_NCOMPPROCS = +if ( ! $?WM_NCOMPPROCS ) then + switch (`uname -s`) + case Linux: + setenv WM_NCOMPPROCS `grep -c processor /proc/cpuinfo` + breaksw + + case Darwin: + setenv WM_NCOMPPROCS `sysctl -n hw.ncpu` + breaksw + + endsw +endif + # Run options (floating-point signal handling and memory initialisation) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~