Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paraview for ICON on Santis #93

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
9 changes: 9 additions & 0 deletions recipes/paraview/v1/gh200/compilers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bootstrap:
spec: [email protected]
gcc:
specs:
- [email protected]
llvm:
requires: [email protected]
specs:
- [email protected]
6 changes: 6 additions & 0 deletions recipes/paraview/v1/gh200/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: paraview-icon
store: /user-environment
spack:
commit: releases/v0.21
repo: https://github.com/spack/spack.git
description: Paraview and the tools required to build ICON
63 changes: 63 additions & 0 deletions recipes/paraview/v1/gh200/environments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
nvidia:
compiler:
- toolchain: gcc
spec: gcc
- toolchain: llvm
spec: nvhpc
unify: when_possible
mpi:
spec: [email protected]%nvhpc
gpu: cuda
specs:
- boost%gcc ~mpi
- [email protected]%gcc
#- [email protected]%nvhpc +tools +fortran +aec +openmp jp2k=jasper
- cmake%gcc
- [email protected]%gcc
- hdf5%gcc
- hwloc%gcc
- netcdf-c%gcc
- netcdf-cxx4%gcc
- netcdf-fortran%nvhpc
- numactl%gcc
- [email protected]%nvhpc
# everything needed for nccl on SS11
- aws-ofi-nccl@master%gcc
- nccl%gcc
- nccl-tests%gcc
# The following are required to stop spack from using nvhpc to build
# basic dependencies, some of which don't compile with nvc etc.
# Explicitly excluded as modules.
- autoconf%gcc
- automake%gcc
- ca-certificates-mozilla%gcc
- diffutils%gcc
- gnuconfig%gcc
- libiconv%gcc
- libxcrypt%gcc
- libxml2%gcc
- m4%gcc
- ncurses%gcc
- openssl%gcc
- perl%gcc
- xz%gcc
- zlib%gcc
- zstd%gcc
- c-blosc%gcc
- libaec%gcc
- jasper%gcc
- patchelf%gcc
- gmake%gcc
- [email protected]%gcc +mpi +tbb +egl ~qt +fortran +python +hdf5 +nvindex +cdi +raytracing +libcatalyst
- llvm~cuda
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround, because of cuda variant which has been set as obsolete starting from llvm@15 by means of a conflict.

https://github.com/spack/spack/blob/e9149cfc3cfc94bd66aa0e0901ce562cf8b75713/var/spack/repos/builtin/packages/llvm/package.py#L380

This was constraining the concretization to llvm@14, which does not support Santis new CUDA architecture.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my cmake-based compilation does not need, or use any llvm. So, there must be something [un-necessary] in the way your spack compilation goes. John Biddiscombe would know more. Please ping him.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

llvm is a dependency of ispc, which is itself a dependency of ospray and openimagedenoise.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, I forgot that one.

- libcatalyst +fortran +python +mpi
variants:
- cuda_arch=90
- +mpi
- +cuda
packages:
- curl
- gmake
views:
default:
link: run
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been changed to run so that all dependencies are exposed in the view.

In particular, without this paraview would not get all dependencies in the view, e.g. mpi4py python package would not be exposed (while it should).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcumming apparently you are the author of the ICON image from where I started.

Do you think this change is problematic? I can try thinking about alternatives, but I don't have the full view of the thing (e.g. should we have a separate view just for paraview?!)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link: run is problematic, because it breaks many command line utilities because they will find dependencies in /user-environment/env/$envname/lib{64}, when they were linked against the versions in /user/lib etc.

The preferred approach is to add all of the specs that you need to expose as roots.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bigger question, is why are we building an environment with both paraview and ICON dependencies together?

The workflow of creating a separate tool environment in /user-tools is designed for this type of use case.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use python, and netcdf from the ICON image (and perhaps other things I forgot). I don't understand enough about the setup to tell if things must be re-build indipendently. But for sure, the ICON-ParaView interface would only be used by ICON users, while ParaView will be used by multiple communities. ParaView must cater to many use-cases (other netcdf users without ICON) (in-situ is another example where the need to have mpi4py exposed forced us to use link: run.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because Paraview should be used by multiple communities, it makes sense to make a separate paraview uenv.
The image can provide its own netcdf etc.

6 changes: 6 additions & 0 deletions recipes/paraview/v1/gh200/extra/reframe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
default:
features: [osu-micro-benchmarks, mpi, serial, openmp]
cc: mpicc
cxx: mpic++
ftn: mpifort
activation: /user-environment/env/default/activate.sh
43 changes: 43 additions & 0 deletions recipes/paraview/v1/gh200/modules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
modules:
# Paths to check when creating modules for all module sets
prefix_inspections:
bin:
- PATH
lib:
- LD_LIBRARY_PATH
lib64:
- LD_LIBRARY_PATH

default:
arch_folder: false
# Where to install modules
roots:
tcl: /snap/modules
tcl:
all:
autoload: none
hash_length: 0
exclude_implicits: true
exclude:
- '%[email protected]'
- 'gcc %[email protected]'
- 'autoconf'
- 'automake'
- 'c-blosc'
- 'ca-certificates-mozilla'
- 'diffutils'
- 'gnuconfig'
- 'jasper'
- 'libaec'
- 'libiconv'
- 'libxcrypt'
- 'libxml2'
- 'patchelf'
- 'm4'
- 'ncurses'
- 'openssl'
- 'xz'
- 'zlib'
- 'zstd'
projections:
all: '{name}/{version}'
50 changes: 50 additions & 0 deletions recipes/paraview/v1/gh200/repo/packages/cdi/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

# ----------------------------------------------------------------------------
# If you submit this package back to Spack as a pull request,
# please first remove this boilerplate and all FIXME comments.
#
# This is a template package file for Spack. We've put "FIXME"
# next to all the things you'll want to change. Once you've handled
# them, you can save this file and test your package like this:
#
# spack install cdi
#
# You can edit this file again by typing:
#
# spack edit cdi
#
# See the Spack documentation for more information on packaging.
# ----------------------------------------------------------------------------

from spack.package import *


class Cdi(AutotoolsPackage):
"""
CDI is a C and Fortran Interface to access Climate and NWP model Data.
Supported data formats are GRIB, netCDF, SERVICE, EXTRA and IEG.
"""

homepage = "https://code.mpimet.mpg.de/projects/cdi"
url = "https://code.mpimet.mpg.de/attachments/download/29309/cdi-2.4.0.tar.gz"

# FIXME: Add the SPDX identifier of the project's license below.
# See https://spdx.org/licenses/ for a list. Upon manually verifying
# the license, set checked_by to your Github username.
# license("UNKNOWN", checked_by="github_user1")

version("2.4.0", sha256="91fca015b04c6841b9eab8b49e7726d35e35b9ec4350922072ec6e9d5eb174ef")

variant("netcdf", default=True, description="This is needed to read/write NetCDF files with CDI")

depends_on("netcdf-c", when="+netcdf")

def configure_args(self):
args = []
if "+netcdf" in self.spec:
args.append("--with-netcdf=" + self.spec["netcdf-c"].prefix)
return args
92 changes: 92 additions & 0 deletions recipes/paraview/v1/gh200/repo/packages/egl/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import re
import sys

from spack.package import *


class Egl(BundlePackage):
"""Placeholder for external EGL(OpenGL) libraries from hardware vendors"""

homepage = "https://www.khronos.org/egl"
maintainers("biddisco")

version("1.5")

# This should really be when='platform=linux' but can't because of a
# current bug in when and how ArchSpecs are constructed
if sys.platform.startswith("linux"):
provides("[email protected]")

# conflict with GLX
conflicts("glx")

# not always available, but sometimes
executables = ["^eglinfo$"]

@classmethod
def determine_version(cls, exe):
if exe:
output = Executable(exe)(output=str, error=str)
match = re.search(r"EGL version string: (\S+)", output)
return match.group(1) if match else None
else:
return None

# Override the fetcher method to throw a useful error message;
# fixes GitHub issue (#7061) in which this package threw a
# generic, uninformative error during the `fetch` step,
@property
def fetcher(self):
msg = """This package is intended to be a placeholder for
system-provided EGL(OpenGL) libraries from hardware vendors. Please
download and install EGL drivers/libraries for your graphics
hardware separately, and then set that up as an external package.
An example of a working packages.yaml:

packages:
egl:
buildable: False
externals:
- spec: [email protected]
prefix: /usr/

In that case, /usr/ should contain these two folders:

include/EGL/ (egl headers, including "egl.h")
lib (egl libraries, including "libEGL.so")

"""
raise InstallError(msg)

@fetcher.setter # Since fetcher is read-write, must override both
def fetcher(self):
_ = self.fetcher

@property
def headers(self):
return self.egl_headers

@property
def libs(self):
return self.egl_libs

@property
def egl_headers(self):
header_name = "GL/gl"
gl_header = find_headers(header_name, root=self.prefix, recursive=True)
header_name = "EGL/egl"
egl_header = find_headers(header_name, root=self.prefix, recursive=True)
return gl_header + egl_header

@property
def egl_libs(self):
lib_name = "libGL"
gl_lib = find_libraries(lib_name, root=self.prefix, recursive=True)
lib_name = "libEGL"
egl_lib = find_libraries(lib_name, root=self.prefix, recursive=True)
return gl_lib + egl_lib
79 changes: 79 additions & 0 deletions recipes/paraview/v1/gh200/repo/packages/glew/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import sys

from spack.package import *


class Glew(CMakePackage):
"""The OpenGL Extension Wrangler Library."""

homepage = "http://glew.sourceforge.net/"
url = "https://github.com/nigels-com/glew/releases/download/glew-2.1.0/glew-2.1.0.tgz"
root_cmakelists_dir = "build/cmake"

maintainers("biddisco")

license("GPL-2.0-or-later")

version("2.2.0", sha256="d4fc82893cfb00109578d0a1a2337fb8ca335b3ceccf97b97e5cc7f08e4353e1")
version("2.1.0", sha256="04de91e7e6763039bc11940095cd9c7f880baba82196a7765f727ac05a993c95")
version("2.0.0", sha256="c572c30a4e64689c342ba1624130ac98936d7af90c3103f9ce12b8a0c5736764")

variant(
"gl",
default="glx" if sys.platform.startswith("linux") else "other",
values=("glx", "osmesa", "egl", "other"),
multi=False,
description="The OpenGL provider to use",
)
conflicts("^osmesa", when="gl=glx")
conflicts("^osmesa", when="gl=egl")
conflicts("^osmesa", when="gl=other")
conflicts("^glx", when="gl=osmesa")
conflicts("^glx", when="gl=other")
conflicts("^glx", when="gl=egl")
conflicts("^egl", when="gl=glx")
conflicts("^egl", when="gl=osmesa")
conflicts("^egl", when="gl=other")

depends_on("gl")
depends_on("osmesa", when="gl=osmesa")
depends_on("glx", when="gl=glx")
depends_on("libx11", when="gl=glx")
depends_on("xproto", when="gl=glx")
depends_on("egl", when="gl=egl")

# glu is already forcibly disabled in the CMakeLists.txt. This prevents
# it from showing up in the .pc file
patch("remove-pkgconfig-glu-dep.patch")

def cmake_args(self):
spec = self.spec
args = [
self.define("BUILD_UTILS", True),
self.define("GLEW_REGAL", False),
self.define("GLEW_EGL", "gl=egl" in spec),
self.define("OPENGL_INCLUDE_DIR", spec["gl"].headers.directories[0]),
self.define("OPENGL_gl_LIBRARY", spec["gl"].libs[0]),
self.define("OPENGL_opengl_LIBRARY", "IGNORE"),
self.define("OPENGL_glx_LIBRARY", "IGNORE"),
self.define("OPENGL_glu_LIBRARY", "IGNORE"),
self.define("GLEW_OSMESA", "gl=osmesa" in spec),
]
if "gl=egl" in spec:
args.append(
self.define("OPENGL_egl_LIBRARY", [spec["egl"].libs[0], spec["egl"].libs[1]])
)
else:
args.append(self.define("OPENGL_egl_LIBRARY", "IGNORE"))

return args

def flag_handler(self, name, flags):
if name == "ldflags" and self.spec.satisfies("platform=darwin ^apple-gl"):
flags.append("-framework OpenGL")
return (flags, None, None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
index 419c243..339617f 100644
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -215,12 +215,7 @@ set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
set (version ${GLEW_VERSION})
set (libname ${GLEW_LIB_NAME})
set (cflags)
-set (requireslib glu)
-
-# Mac OSX has no glu.pc unless optional X11/GLX is installed
-if (APPLE)
- set (requireslib)
-endif ()
+set (requireslib)

configure_file (${GLEW_DIR}/glew.pc.in ${CMAKE_CURRENT_BINARY_DIR}/glew.pc @ONLY)

Loading