Skip to content

Commit

Permalink
Third party libraries for Casper (#3606)
Browse files Browse the repository at this point in the history
* Test

* Test

* test

* revert tests

* fix linux build

* set third party libraries on casper

* add LD_LIBRARY_PATH warning

---------

Co-authored-by: StasJ <StasJ@users.noreply.github.com>
  • Loading branch information
sgpearse and StasJ authored Jun 30, 2024
1 parent 755464c commit 31fdd78
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 22 deletions.
39 changes: 27 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ anchors:
- &macx86libAWS "2023-Jun-macOSx86.tar.xz"
- &macArm64libAWS "2023-Sept-M1.tar.xz"
- &u20libAWS "2023-Sept-Ubuntu20.tar.xz"
- &srcLibAWS "2023-Sept-src.tar.xz"

version: 2.1

Expand All @@ -35,22 +36,25 @@ commands:
sudo:
type: string
default: ""
dir:
type: string
default: "/usr/local/VAPOR-Deps"
steps:
- run:
name: get third party libraries
command: |
# if /usr/local/VAPOR-Deps is empty, acquire libraries
if [ ! -d /usr/local/VAPOR-Deps ]; then
<<parameters.sudo>> mkdir -p /usr/local/VAPOR-Deps
<<parameters.sudo>> chmod -R 777 /usr/local/VAPOR-Deps
<<parameters.sudo>> chown -R `whoami` /usr/local/VAPOR-Deps
if [ ! -d <<parameters.dir>> ]; then
<<parameters.sudo>> mkdir -p <<parameters.dir>>
<<parameters.sudo>> chmod -R 777 <<parameters.dir>>
<<parameters.sudo>> chown -R `whoami` <<parameters.dir>>
if <<parameters.useAWS>> ; then
wget https://vaporawsbucket.s3.us-west-2.amazonaws.com/<<parameters.fileName>>
else
id=<<parameters.driveID>>
gdown https://drive.google.com/uc?id=${id}
fi
tar -xf <<parameters.fileName>> -C /usr/local/VAPOR-Deps
tar -xf <<parameters.fileName>> -C <<parameters.dir>>
fi
build_vapor:
Expand All @@ -66,12 +70,17 @@ commands:
default: ""
moveToCommand:
type: string
libDir:
type: string
default: "/usr/local/VAPOR-Deps"
libName:
type: string
default: 2023-Sept
steps:
- run:
name: build vapor
command: |
libraryDir=`ls /usr/local/VAPOR-Deps`
ln -s $libraryDir /usr/local/VAPOR-Deps/current
ln -s <<parameters.libDir>>/<<parameters.libName>> <<parameters.libDir>>/current
cp site_files/site.NCAR site.local
mkdir -p build
cd build
Expand All @@ -81,7 +90,8 @@ commands:
-DCMAKE_BUILD_TYPE:String=Release \
-DDIST_INSTALLER:string=ON \
-DUSE_OMP=ON \
<<parameters.compileArgs>> ..
<<parameters.compileArgs>> \
-DTHIRD_PARTY_DIR=<<parameters.libDir>>/current ..
make -j4
make installer
for f in VAPOR3-* ; do mv "$f" "<<parameters.moveToCommand>>" ; done
Expand Down Expand Up @@ -256,6 +266,7 @@ jobs:
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang \
-DBUILD_OSP=OFF \
libName: 2023-Jun
moveToCommand: ${f/Darwin/DarwinM1}

- run:
Expand Down Expand Up @@ -721,20 +732,24 @@ jobs:
bzip2 \
make \
which \
git
git \
wget
- get_libraries:
fileName: 2023-Sept-src.tar.xz
driveID: *srcLibID
driveID: *srcLibAWS
dir: /glade/campaign/cisl/vast/vapor/third-party

- run:
name: build libraries
command: |
chmod 777 /root/project/scripts/build3rdParty.sh
/root/project/scripts/build3rdParty.sh -o suse
/root/project/scripts/build3rdParty.sh -o suse -b /glade/campaign/cisl/vast/vapor/third-party/
- build_vapor:
moveToCommand: ${f/Linux/Ubuntu20}
moveToCommand: ${f/Linux/SUSE}
libDir: /glade/campaign/cisl/vast/vapor/third-party
libName: 2024-Apr

- store_artifacts:
path: |
Expand Down
29 changes: 20 additions & 9 deletions scripts/build3rdParty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,31 @@

set -e

while getopts o:b:i flag
do
while getopts "o:b:" flag; do
case "${flag}" in
b) srcDir=${OPTARG};;
i) installDir=${OPTARG};;
o) OS=${OPTARG};;
b) baseDir=${OPTARG};;
esac
done

#OS="CentOS"
baseDir='/usr/local/VAPOR-Deps'
if [ -z "$OS" ]; then
echo "Error: -o flag is required to specify the target operating system [suse, maxOSx86, M1, CentOS, Ubuntu]"
exit 1
fi

if [ -z "$baseDir" ]; then
echo "No -b (base directory) option given. Defaulting to /usr/local/VAPOR-Deps"
baseDir='/usr/local/VAPOR-Deps'
fi
#baseDir='/glade/campaign/cisl/vast/vapor/third-party'

if [ "$OS" != "suse" ]; then
srcDir="$baseDir/2023-Jun-src"
archiveName="2023-Jun"
else
srcDir="$baseDir/2023-Sept-src"
archiveName="2023-Sept"
archiveName="2024-Apr"
fi
echo srcDir $srcDir
echo OS ${OS}

installDir="$baseDir/current"
getMacOSMinVersion() {
Expand All @@ -39,6 +44,12 @@ getMacOSMinVersion() {
echo "12.0.0"
fi
}

echo OS ${OS}
echo baseDir $baseDir
echo srcDir $srcDir
echo installDir $installDir

macOSMinVersion=$(getMacOSMinVersion)

shopt -s expand_aliases
Expand Down
24 changes: 23 additions & 1 deletion site_files/site.NCAR
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,35 @@ if (APPLE)
list (APPEND CMAKE_PREFIX_PATH ${QTDIR}/lib/cmake )
set (OSPRAYDIR ${THIRD_PARTY_DIR}/Ospray )
elseif (UNIX AND NOT APPLE)
# Try to heuristically configure our third party libraries
if (NOT DEFINED THIRD_PARTY_DIR)
set (THIRD_PARTY_DIR /usr/local/VAPOR-Deps/current )
# If we're on casper, and set third party libraries accordingly
execute_process(
COMMAND uname -a
COMMAND grep -o "casper"
RESULT_VARIABLE casperFound
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if ("${casperFound}" EQUAL "0")
set (THIRD_PARTY_DIR /glade/campaign/cisl/vast/vapor/third-party/current)
message(STATUS "***")
message(STATUS "***")
message(STATUS " NOTICE: TO BUILD ON CASPER, NCAR'S ENVIRONMENT MUST BE UNLOADED WITH")
message(STATUS " module --force unload ncarenv")
message(STATUS " TO RUN VAPOR ON CASPER, LD_LIBRARY_PATH MUST BE MODIFIED TO")
message(STATUS " export LD_LIBRARY_PATH=${THIRD_PARTY_DIR}:$LD_LIBRARY_PATH")
message(STATUS "***")
message(STATUS "***")
else()
# Otherwise set the library path to our usual target
set (THIRD_PARTY_DIR /usr/local/VAPOR-Deps/current )
endif()
endif()
if (NOT DEFINED QTDIR)
#set (QTDIR ${THIRD_PARTY_DIR}/Qt/5.15.2/gcc_64)
set (QTDIR ${THIRD_PARTY_DIR})
endif()

set (CMAKE_PREFIX_PATH ${QTDIR}/lib/cmake )
set (Qt5Core_DIR ${QTDIR}/lib/cmake/Qt5Core )
set (QT_QMAKE_EXECUTABLE ${QTDIR}/gcc_64/bin/qmake )
Expand Down

0 comments on commit 31fdd78

Please sign in to comment.