Skip to content

Commit

Permalink
[insitu] Added instr. how to build with PVs Catalyst lib.
Browse files Browse the repository at this point in the history
  • Loading branch information
bilke committed Mar 23, 2017
1 parent 6790605 commit d43b5d7
Show file tree
Hide file tree
Showing 5 changed files with 320 additions and 0 deletions.
32 changes: 32 additions & 0 deletions scripts/catalyst/Editions/ogs/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"edition": "ogs",
"requires": [
"Extras"
],
"after": [
"Enable-Python",
"Extras"
],
"cmake":{
"cache":[
{ "name":"Module_vtkIOXML",
"type":"BOOL",
"value":"ON"
}
]
},
"modules":[
{ "name": "vtkIOXML",
"path": "VTK/IO/XML",
"include": [
{ "class": "vtkXMLUnstructuredGridReader" },
{ "class": "vtkXMLReader" },
{ "class": "vtkXMLUnstructuredDataReader" },
{ "class": "vtkXMLFileReadTester" },
{ "class": "vtkXMLDataReader" }
],
"cswrap": true,
"pythonwrap": true
}
]
}
38 changes: 38 additions & 0 deletions scripts/catalyst/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generate OGS Catalyst edition

Clone ParaView:

```bash
git clone https://gitlab.kitware.com/paraview/paraview.git
cd paraview
git submodule init
git submodule update
```

Go to ogs source directoy and run script `generate-ogs-edition.sh` with the path to the cloned ParaView directory as an argument:

```bash
cd ogs/scripts/catalyst
./generate-ogs-edition.sh ~/code/catalyst/paraview
```

This will generate the file `Catalyst-ogs-Base-Enable-Python-Essentials-Extras-ogs-Rendering-Base.tar.gz` in `[paraview-dir]/Catalyst/`

# Build the OGS Catalyst edition

- Untar the edition
- `cd` into it and create a `build`-directory
- Build with `cmake.sh`:

```bash
../cmake.sh .. [Optional CMake parameter]
make
```

# Use the OGS Catalyst edition

Enable `OGS_INSITU` and point to build directory where the edition was built:

```bash
cmake ../ogs -DOGS_INSITU=ON -DParaView_DIR=[path to edition build dir]
```
16 changes: 16 additions & 0 deletions scripts/catalyst/generate-ogs-edition.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# A quick script to generate source tarball for the ogs edition.

usage="$0 <ParaView source dir>"
# A handy function for handling errors.
die () {
echo >&2 "$@"
exit 1
}

pv_dir="$1"

cp * $pv_dir/Catalyst
cd $pv_dir/Catalyst
./generate-tarballs.sh ogs
71 changes: 71 additions & 0 deletions scripts/catalyst/generate-tarballs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash

# A quick script to generate source tarball for all editions.

usage="$0 <suffix>"
# A handy function for handling errors.
die () {
echo >&2 "$@"
exit 1
}


TARGET_FILE=$0

cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`

# Iterate down a (possible) chain of symlinks
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=`readlink $TARGET_FILE`
cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`
done

# Compute the canonicalized name by finding the physical path
# for the directory we're in and appending the target file.
PHYS_DIR=`pwd -P`
RESULT=$PHYS_DIR/$TARGET_FILE
echo $RESULT

[ "$#" -lt 1 ] && \
die "$usage"

scriptdir="$RESULT"
scriptdir="$( dirname "$scriptdir" )"

suffix="$1"
src_output="$( pwd )"

generate_edition () {
local parts="$@"
cmd=""
editionsuffix=""
for part in $parts; do
cmd="$cmd --input $part"
editionsuffix="$editionsuffix-$part"
done
$scriptdir/test-catalyst.sh $(pwd)/Catalyst-$suffix$editionsuffix \
$scriptdir/tmp \
--no-configure --no-build --no-test --remove-dirs $cmd
tar zcf Catalyst-$suffix$editionsuffix.tar.gz Catalyst-$suffix$editionsuffix
mv Catalyst-$suffix$editionsuffix.tar.gz ../
}

rm -rf $src_output/__tmp__
mkdir -p $src_output/__tmp__
cd $src_output/__tmp__
# generate_edition "HostTools"
# generate_edition "Base"
# generate_edition "Base" "Essentials"
# generate_edition "Base" "Essentials" "Extras"
# generate_edition "Base" "Essentials" "Extras" "Rendering-Base"
#
# generate_edition "Base" "Enable-Python"
# generate_edition "Base" "Enable-Python" "Essentials"
# generate_edition "Base" "Enable-Python" "Essentials" "Extras"
# generate_edition "Base" "Enable-Python" "Essentials" "Extras" "Rendering-Base"
generate_edition "Base" "Enable-Python" "Essentials" "Extras" "ogs" "Rendering-Base"
cd ../
rm -rf $src_output/__tmp__
163 changes: 163 additions & 0 deletions scripts/catalyst/test-catalyst.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#!/bin/sh

usage="$0 <catalyst srcdir> <catalyst builddir> [--install] [--no-configure] [--no-build] [--no-test] [--remove-dirs] --input <edition> [--input <edition>]... [--] [<cmake arguments>...]"

# A handy function for handling errors.
die () {
echo >&2 "$@"
exit 1
}

[ "$#" -lt 3 ] && \
die "$usage"

TARGET_FILE=$0

cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`

# Iterate down a (possible) chain of symlinks
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=`readlink $TARGET_FILE`
cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`
done

# Compute the canonicalized name by finding the physical path
# for the directory we're in and appending the target file.
PHYS_DIR=`pwd -P`
RESULT=$PHYS_DIR/$TARGET_FILE
echo $RESULT

curscript="$RESULT"
scriptdir="$( dirname "$curscript" )"

# Where the edition directories live.
editiondir="$scriptdir/Editions"

# The output directory to catalyze into.
src_output="$1"
shift

[ -d "$src_output/.git" ] && \
die "Refusing to use a git repository as the source output directory"

# The output directory to build into.
bin_output="$1"
shift

# Parse out --input parameters.
editions=
args=
remove=
no_configure=
no_build=
no_test=
install=
while [ "$#" -gt 0 ]; do
case "$1" in
--input)
shift
edition="$1"

# Fail on non-existent editions.
[ -d "$editiondir/$edition" ] || \
die "The $edition edition does not exist"

editions="$editions $edition"
args="$args -i $editiondir/$edition"
;;
--remove-dirs)
remove=y
;;
--no-configure)
no_configure=y
;;
--no-build)
no_build=y
;;
--no-test)
no_test=y
;;
--install)
install=y
;;
--)
break
;;
*)
break
;;
esac
shift
done

# We need at least one edition to catalyze.
[ -z "$editions" ] && \
die "Need at least one input"

if [ -n "$no_build" ] && [ -n "$install" ]; then
die "--install requires a build"
fi

# Remove directories if requested
[ -n "$remove" ] && \
rm -rf "$src_output" "$bin_output"

# Catalyze.
mkdir -v -p "$src_output"
python "$scriptdir/catalyze.py" -r "$scriptdir/.." $args -o "$src_output" || \
die "Failed to catalyze"

[ -n "$no_configure" ] && exit 0

# Configure the catalyzed tree.
mkdir -v -p "$bin_output"
cd "$bin_output"
"$src_output/cmake.sh" "$@" "$src_output" || \
die "Failed to configure the tree"

if [ -z "$no_build" ]; then
cd "$bin_output"
cmake --build . || \
die "Failed to build"
fi

# Test if wanted.
if [ -z "$no_test" ]; then
# Create the testing directory.
mkdir -v "$src_output/Testing"
for edition in $editions; do
[ -d "$editiondir/$edition/Testing" ] || continue

cp -rv "$editiondir/$edition/Testing/"* "$src_output/Testing" || \
die "Failed to copy tests for edition $edition"
done

# Configure the testing tree.
mkdir -v -p "$bin_output/Testing"
cd "$bin_output/Testing"
cmake "$@" \
"-DPVPYTHON_EXE=$bin_output/bin/pvpython" \
"-DParaView_DIR=$bin_output" \
"$src_output/Testing" || \
die "Failed to configure tests"

if [ -z "$no_build" ]; then
# Build the testing tree.
cd "$bin_output/Testing"
cmake --build . || \
die "Failed to build tests"

# Run the tests.
ctest -VV || \
die "Tests failed"
fi
fi

if [ -n "$install" ]; then
cd "$bin_output"
cmake --build . --target install || \
die "Failed to install"
fi

0 comments on commit d43b5d7

Please sign in to comment.