Skip to content

Commit 0f3d1a1

Browse files
committed
Try to discover CPU count on our own
1 parent 7be92bd commit 0f3d1a1

File tree

8 files changed

+33
-8
lines changed

8 files changed

+33
-8
lines changed

conda/libmesh-vtk/build.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
set -eu
33
export PATH=/bin:$PATH
44

5+
if [ -f utils.sh ]; then
6+
source utils.sh
7+
fi
8+
59
if [[ $mpi == "openmpi" ]]; then
610
export OMPI_MCA_plm=isolated
711
export OMPI_MCA_rmaps_base_oversubscribe=yes
@@ -30,8 +34,7 @@ cmake .. -G "Ninja" \
3034
-DVTK_GROUP_ENABLE_Web:STRING=NO \
3135
-DCMAKE_OSX_SYSROOT=${CONDA_BUILD_SYSROOT}
3236

33-
CORES=$(echo "${CPU_COUNT:-2} / 2" | bc)
34-
ninja install -v -j $CORES
37+
ninja install -v -j $CPU_COUNT
3538

3639
# VTK 9.1 now places libs in lib64 when installed on linux, linking to the "expected" location of lib
3740
if [[ $(uname) == Linux ]]; then

conda/libmesh-vtk/utils.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../mpich/utils.sh

conda/libmesh/build.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ if [ -z $PETSC_DIR ]; then
1010
exit 1
1111
fi
1212

13+
if [ -f utils.sh ]; then
14+
source utils.sh
15+
fi
16+
1317
function sed_replace(){
1418
if [ `uname` = "Darwin" ]; then
1519
sed -i '' -e "s|${BUILD_PREFIX}|${PREFIX}|g" $PREFIX/libmesh/bin/libmesh-config
@@ -79,8 +83,7 @@ LIBMESH_DIR=${PREFIX}/libmesh \
7983
--with-vtk-include=${BUILD_PREFIX}/libmesh-vtk/include/vtk-${SHORT_VTK_NAME} \
8084
$*
8185

82-
CORES=$(echo "${CPU_COUNT:-2} / 2" | bc)
83-
make -j $CORES
86+
make -j $CPU_COUNT
8487
make install
8588
sed_replace
8689

conda/libmesh/utils.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../mpich/utils.sh

conda/mpich/build.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/bin/bash
22
set -eu
3-
printf "\n\n\n\n`env`\n\n\n\n"
43
export PATH=/bin:$PATH
5-
64
export FCFLAGS="$FFLAGS"
75
export CC=$(basename "$CC")
86
export CXX=$(basename "$CXX")
97
export FC=$(basename "$FC")
108

9+
if [ -f utils.sh ]; then
10+
source utils.sh
11+
fi
12+
1113
if [[ $HOST == arm64-apple-darwin20.0.0 ]]; then
1214
# use Conda-Forge's Arm64 config.guess and config.sub, see
1315
# https://conda-forge.org/blog/posts/2020-10-29-macos-arm64/
@@ -92,8 +94,8 @@ fi
9294
CFLAGS="${CTUNING}" CXXFLAGS="${CTUNING}" FFLAGS="${FTUNING}" LDFLAGS="${LDFLAGS}" \
9395
FCFLAGS="${FTUNING}" F90FLAGS="" F77FLAGS="" \
9496
${OPTIONS}
95-
CORES=$(echo "${CPU_COUNT:-2} / 2" | bc)
96-
make -j $CORES
97+
printf "Building with $CPU_COUNT cores...\n"
98+
make -j $CPU_COUNT
9799
make install
98100

99101
# Set MPICH environment variables for those that need it, and set CXXFLAGS using our ACTIVATION_CXXFLAGS variable

conda/mpich/utils.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# establish cores, or reasonable default
2+
if [ -z "$CPU_COUNT" ]; then
3+
if [ `uname` == "Darwin" ]; then
4+
CPU_COUNT=$(echo "$(sysctl -n hw.ncpu) / 2" | bc)
5+
elif [ `which nproc` ]; then
6+
CPU_COUNT=$(echo `nproc` / 2 | bc)
7+
else
8+
CPU_COUNT=4
9+
fi
10+
fi

conda/petsc/build.sh

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export CC=$(basename "$CC")
99
export CXX=$(basename "$CXX")
1010
export FC=$(basename "$FC")
1111

12+
if [ -f utils.sh ]; then
13+
source utils.sh
14+
fi
15+
1216
# feed-stock recommendation
1317
# scrub debug-prefix-map args, which cause problems in pkg-config
1418
export CFLAGS=$(echo ${CFLAGS:-} | sed -E 's@\-fdebug\-prefix\-map[^ ]*@@g')

conda/petsc/utils.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../mpich/utils.sh

0 commit comments

Comments
 (0)