Skip to content

Commit

Permalink
New hybrid approach to paraview install using cmake directly
Browse files Browse the repository at this point in the history
Install dependencies using spack, but check out custom branches
of paraview / VTK / vtkm to work around compilation issues with the
default spack available branches.
Compile using cmake and a build-env generated by creating a fake package
with all the dependencies we need added into it and concretized with the
original spack/stackinator generated environment
  • Loading branch information
biddisco committed Feb 26, 2024
1 parent 2708f81 commit 41e09f6
Show file tree
Hide file tree
Showing 6 changed files with 367 additions and 23 deletions.
2 changes: 1 addition & 1 deletion recipes/paraview/gh200/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: prgenv-gnu
spack:
commit: h5hut
commit: jb-develop
repo: /bret/scratch/cscs/biddisco/spack-santis
store: /user-environment
description: ParaView + assorted other tools
Expand Down
73 changes: 73 additions & 0 deletions recipes/paraview/gh200/env-to-package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# read a yaml file and convert it to a spack package
# usage: python env-to-package.py <env.yaml> <package-name>
# example: python env-to-package.py paraview-env.yaml paraview

# load a yaml file
import yaml
import sys
import os

packagename = "temppackage"
packagenameU = packagename[0].upper() + packagename[1:]

# read the yaml file
filename = sys.argv[1]
with open(filename, 'r') as stream:
try:
env = yaml.safe_load(stream)
except yaml.YAMLError as exc:
print(exc)

# change the following generation of the file to a string with the same contents
output = f"# This file was auto-generated from {filename}\n"
output += "\n"
output += "import itertools, os, sys\n"
output += "from spack import *\n"
output += "\n"
output +=f"class {packagenameU}(CMakePackage):\n"
output += " homepage = \"https://www.dummy.org/\"\n"
output += " url = \"https://www.dummy.org/\"\n"
output += " git = \"https://www.dummy.org/\"\n"
output += "\n"
output += " version(\"develop\", branch=\"main\")\n"

# extract the dependencies from the yaml specs section, assume 'spec' is one level down from top level key
# doign this allows us to import an env from stackinator, or a regular env yaml file
try:
specs = env[list(env.keys())[0]]['specs']
except KeyError:
print("No specs found in the yaml file - is 'spec' a top level key?")
sys.exit(1)

dependencies = []
for spec in specs:
output += f" depends_on(\"{spec}\")\n"
#
print(output)

# get SPACK_ROOT by executing shell command
spack_package_root = os.popen('spack location -r').read().strip() + "/var/spack/repos/builtin/packages"

# create a subdir named after the package if the subdir doesn't already exist
tempdir = os.path.join(spack_package_root, packagename)
if not os.path.exists(tempdir):
os.makedirs(tempdir)
print('Writing temp package to ' + os.path.join(tempdir, 'package.py'))

# create a temp file in the directory
tempfile = os.path.join(tempdir, 'package.py')
with open(tempfile, 'w') as f:
f.write(output)
f.close()
print(f"Temporary file {tempfile} has been created")

print(f'spackgen {packagename} "{packagename} %gcc" --reuse')


# call spack to install the package - print error if it fails

#os.system(f"spack info {packagename}")
#os.system(f'. /home/biddisco/opt/spack.git/share/spack/setup-env.sh ; /home/biddisco/src/_env/devenv/spackgen.sh temp "{packagename}%gcc" --reuse')

# rewrite /home/biddisco/src/_env/bash/devenv/spackgen.sh as a python script

123 changes: 107 additions & 16 deletions recipes/paraview/gh200/environments.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gcc-env:
pv-egl-cuda:
compiler:
- toolchain: gcc
spec: gcc
Expand All @@ -7,37 +7,128 @@ gcc-env:
gpu: cuda
unify: true
specs:
# Build tools
- git-lfs
- cmake
- ninja
- direnv
- fftw
- fmt
- stdexec
- boost +atomic +chrono +container +context +coroutine +date_time +filesystem +graph +json +mpi +multithreaded +program_options +regex +serialization +shared +system +test +thread
- hdf5 +mpi
- h5hut
- ninja
- openblas threads=openmp
- llvm@14 ~gold ~cuda
# maths
- blaspp
- eigen
- fftw
- lapackpp
- [email protected]
- [email protected]
- openblas
- proj
# c++ helperrs
- fmt
- stdexec@main
- boost +atomic +chrono +container +context +coroutine +date_time +filesystem +graph +json +mpi +multithreaded +program_options +regex +serialization +shared +system +test +thread
# IO and parallelism
- hdf5 +mpi +cxx +hl +threadsafe +shared ~java
- netcdf-c +mpi
- h5hut@master
- lz4
# cuda
- [email protected]
- py-pandas
- py-matplotlib
# memory management
- jemalloc
- mimalloc
# system
- numactl
# profiling/testing
- gperftools
- googletest
# multithreading
- tbb
# in-situ support
- libcatalyst +mpi
# vtk external deps
- [email protected]
- [email protected]
- gl2ps
- glew gl=egl
- jpeg
- jsoncpp
- libharu
- libtiff
- nlohmann-json
- libtheora@master
- pugixml
# [email protected] - 3.21 to prevent abseil being pulled in @3.22:
- protobuf@:3.21
- seacas
- utf8cpp
# python
- [email protected]
- py-pandas
- py-matplotlib
- py-mpi4py
#- [email protected] +cuda cuda_arch=90
#- vtk@master +egl +mpi +opengl2 +python +cuda
# paraview@master +vtk +mpi +opengl2 +egl +catalyst ~raytracing +python use_vtkm=off +development_files build_edition=rendering

#- openimagedenoise@master
#- ispc@main
# - ospray
# We turn off hdf5 because vtk::hdf5 needs the internal hdf5 not the external one
- [email protected] +cuda +mpi ~hdf5 +opengl2 +tbb +raytracing +python use_vtkm=on +development_files build_edition=rendering
variants:
- build_type=Release
- +mpi
- +cuda
- cuda_arch=90
- ~fortran
- build_type=Release
- cxxstd=20
- ~x11
- ~examples
views:
default:
link: roots

# pv-osmesa:
# compiler:
# - toolchain: gcc
# spec: gcc
# mpi:
# spec: [email protected]
# gpu: cuda
# unify: true
# specs:
# - cmake
# - ninja
# - direnv
# - fftw
# - fmt
# - stdexec
# - boost +atomic +chrono +container +context +coroutine +date_time +filesystem +graph +json +mpi +multithreaded +program_options +regex +serialization +shared +system +test +thread
# - hdf5 +mpi
# - h5hut@master
# - ninja
# - llvm@14 ~gold ~cuda
# - openblas
# - blaspp
# - lapackpp
# - [email protected]
# - [email protected]
# - py-pandas
# - py-matplotlib
# - tbb
# - libtheora@master
# - [email protected] +cuda cuda_arch=90
# - vtk@master +egl +mpi +opengl2 +python +cuda
# - paraview@master +vtk +mpi +opengl2 +osmesa +tbb +raytracing +python use_vtkm=on +development_files build_edition=rendering

# #- openimagedenoise@master
# #- ispc@main
# # - ospray
# # We turn off hdf5 because vtk::hdf5 needs the internal hdf5 not the external one
# variants:
# - +mpi
# - +cuda
# - cuda_arch=90
# - ~fortran
# - build_type=Release
# - cxxstd=20
# - ~examples
# views:
# default:

11 changes: 11 additions & 0 deletions recipes/paraview/gh200/packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
packages:
all:
providers:
gl: [egl]
egl:
externals:
- spec: [email protected]
prefix: /usr
buildable: false
llvm:
require: llvm ~gold ~cuda
Loading

0 comments on commit 41e09f6

Please sign in to comment.