Skip to content

Commit

Permalink
Enforce consistency of gl providers (spack#44307)
Browse files Browse the repository at this point in the history
* glew: rework dependency on gl

This simplifies the package and ensures a single gl implementation is
pulled in. Before we were adding direct dependencies, and those are
not unified through the virtual.

* mesa-demos: rework dependency on gl

This simplifies the package and ensures a single gl implementation is
pulled in. Before we were adding direct dependencies, and those are
not unified through the virtual.

* mesa-glu: rework dependency on gl

This simplifies the package and ensures a single gl implementation is
pulled in. Before we were adding direct dependencies, and those are
not unified through the virtual.

* paraview: fix dependency on glew

* mesa: group dependency on when("+glx")

* Add missing dependency on libxml2

* paraview: remove the "osmesa" and "egl" variant

Instead, enforce consistency using the "gl" virtual that allows
only one provider.

* visit: remove osmesa variant

* Disable paraview in the aws-isc stacks

* data-vis-sdk: rework constrains to enforce front-ends

* e4s-power: remove redundant paraview

* Pipelines: update osmesa variants

* trilinos-catalyst-ioss-adapter: make gl a run dependency
  • Loading branch information
alalazo authored and teaguesterling committed Jun 15, 2024
1 parent d381c62 commit dc9a6c2
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ spack:
- openfoam
- osu-micro-benchmarks
- parallel
- paraview
# - paraview
- picard
- quantum-espresso
- raja
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ spack:
- openfoam
- osu-micro-benchmarks
- parallel
- paraview
# - paraview
- picard
- quantum-espresso
# Build broken for gcc@7.3.1 x86_64_v4 (error: '_mm512_loadu_epi32' was not declared in this scope)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ spack:
- paraview_specs:
- matrix:
- - paraview +raytracing
- - +qt~osmesa # GUI Support w/ GLX Rendering
- ~qt~osmesa # GLX Rendering
- ~qt+osmesa # OSMesa Rendering
- - +qt ^[virtuals=gl] glx # GUI Support w/ GLX Rendering
- ~qt ^[virtuals=gl] glx # GLX Rendering
- ^[virtuals=gl] osmesa # OSMesa Rendering
- visit_specs:
- matrix:
- - visit
- - ~gui~osmesa # GLX Rendering
- ~gui+osmesa # OSMesa Rendering
- - visit~gui
- - ^[virtuals=gl] glx # GLX Rendering
- ^[virtuals=gl] osmesa # OSMesa Rendering
# VisIt GUI does not work with Qt 5.14.2
# - +gui~osmesa # GUI Support w/ GLX Rendering
# - +gui ^[virtuals=gl] glx # GUI Support w/ GLX Rendering
- sdk_base_spec:
- matrix:
- - ecp-data-vis-sdk +ascent +adios2 +cinema +darshan +faodel +hdf5 +pnetcdf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spack:
variants: +termlib
paraview:
# Don't build GUI support or GLX rendering for HPC/container deployments
require: "@5.11 ~qt+osmesa"
require: "@5.11 ~qt ^[virtuals=gl] osmesa"
python:
version: [3.8.13]
trilinos:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spack:
variants: +termlib
paraview:
# Don't build GUI support or GLX rendering for HPC/container deployments
require: "@5.11 ~qt+osmesa"
require: "@5.11 ~qt ^[virtuals=gl] osmesa"
python:
version: [3.8.13]
trilinos:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ spack:
- hdf5
- libcatalyst
- parallel-netcdf
- paraview
- py-cinemasci
- sz
- unifyfs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spack:
variants: threads=openmp
paraview:
# Don't build GUI support or GLX rendering for HPC/container deployments
require: "@5.11 ~qt+osmesa"
require: "@5.11 ~qt ^[virtuals=gl] osmesa"

# ROCm 5.4.3
comgr:
Expand Down
2 changes: 1 addition & 1 deletion share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ spack:
version: [11.8.0]
paraview:
# Don't build GUI support or GLX rendering for HPC/container deployments
require: "@5.11 ~qt+osmesa"
require: "@5.11 ~qt ^[virtuals=gl] osmesa"

specs:
# CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spack:
variants: threads=openmp
paraview:
# Don't build GUI support or GLX rendering for HPC/container deployments
require: "@5.11 ~qt+osmesa"
require: "@5.11 ~qt ^[virtuals=gl] osmesa"
trilinos:
require: +amesos +amesos2 +anasazi +aztec +boost +epetra +epetraext
+ifpack +intrepid +intrepid2 +isorropia +kokkos +ml +minitensor +muelu
Expand Down
35 changes: 6 additions & 29 deletions var/spack/repos/builtin/packages/glew/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# 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 *


Expand All @@ -23,29 +20,9 @@ class Glew(CMakePackage):
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")
depends_on("libx11", when="^[virtuals=gl] glx")
depends_on("xproto", when="^[virtuals=gl] glx")

# glu is already forcibly disabled in the CMakeLists.txt. This prevents
# it from showing up in the .pc file
Expand All @@ -56,15 +33,15 @@ def cmake_args(self):
args = [
self.define("BUILD_UTILS", True),
self.define("GLEW_REGAL", False),
self.define("GLEW_EGL", "gl=egl" in spec),
self.define("GLEW_EGL", spec.satisfies("^[virtuals=gl] egl")),
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),
self.define("GLEW_OSMESA", spec.satisfies("^[virtuals=gl] osmesa")),
]
if "gl=egl" in spec:
if spec.satisfies("^[virtuals=gl] egl"):
args.append(
self.define("OPENGL_egl_LIBRARY", [spec["egl"].libs[0], spec["egl"].libs[1]])
)
Expand All @@ -76,4 +53,4 @@ def cmake_args(self):
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)
return flags, None, None
24 changes: 4 additions & 20 deletions var/spack/repos/builtin/packages/mesa-demos/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# 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 *


Expand All @@ -20,29 +18,15 @@ class MesaDemos(AutotoolsPackage):
version("8.2.0", sha256="5a9f71b815d968d0c3b77edfcc3782d0211f8520b00da9e554ccfed80c8889f6")
version("8.1.0", sha256="cc5826105355830208c90047fc38c5b09fa3ab0045366e7e859104935b00b76d")

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

depends_on("autoconf", type="build")
depends_on("automake", type="build")
depends_on("libtool", type="build")
depends_on("m4", type="build")
depends_on("pkgconfig", type="build")

depends_on("gl")
depends_on("osmesa", when="gl=osmesa")
depends_on("glx", when="gl=glx")
depends_on("libx11", when="gl=glx")
depends_on("libxext", when="gl=glx")
depends_on("libx11", when="^[virtuals=gl] glx")
depends_on("libxext", when="^[virtuals=gl] glx")

depends_on("glu")
depends_on("glew@1.5.4:")
Expand All @@ -64,11 +48,11 @@ def configure_args(self):
"--disable-rbug",
"--without-glut",
]
if "gl=glx" in spec:
if spec.satisfies("^[virtuals=gl] glx"):
args.append("--enable-x11")
else:
args.append("--disable-x11")
if "gl=osmesa" in spec:
if spec.satisfies("^[virtuals=gl] osmesa"):
args.append("--enable-osmesa")
else:
args.append("--disable-osmesa")
Expand Down
20 changes: 1 addition & 19 deletions var/spack/repos/builtin/packages/mesa-glu/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# 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 *


Expand All @@ -18,22 +15,7 @@ class MesaGlu(AutotoolsPackage):
version("9.0.1", sha256="f6f484cfcd51e489afe88031afdea1e173aa652697e4c19ddbcb8260579a10f7")
version("9.0.0", sha256="4387476a1933f36fec1531178ea204057bbeb04cc2d8396c9ea32720a1f7e264")

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

depends_on("gl@3:")
depends_on("osmesa", when="gl=osmesa")
depends_on("glx", when="gl=glx")

provides("glu@1.3")

# When using -std=c++17, using register long will throw an error. This
Expand All @@ -43,7 +25,7 @@ class MesaGlu(AutotoolsPackage):
def configure_args(self):
args = ["--disable-libglvnd"]

if "gl=osmesa" in self.spec:
if self.spec.satisfies("^[virtuals=gl] osmesa"):
args.append("--enable-osmesa")
else:
args.append("--disable-osmesa")
Expand Down
14 changes: 8 additions & 6 deletions var/spack/repos/builtin/packages/mesa/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Mesa(MesonPackage):
depends_on("unwind")
depends_on("expat")
depends_on("zlib-api")
depends_on("libxml2")

# Internal options
variant("llvm", default=True, description="Enable LLVM.")
Expand Down Expand Up @@ -111,12 +112,13 @@ class Mesa(MesonPackage):
depends_on("libllvm@:12", when="@:21")
depends_on("libllvm@:17", when="@:23")

depends_on("libx11", when="+glx")
depends_on("libxcb", when="+glx")
depends_on("libxext", when="+glx")
depends_on("libxt", when="+glx")
depends_on("xrandr", when="+glx")
depends_on("glproto@1.4.14:", when="+glx")
with when("+glx"):
depends_on("libx11")
depends_on("libxcb")
depends_on("libxext")
depends_on("libxt")
depends_on("xrandr")
depends_on("glproto@1.4.14:")

# version specific issue
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96130
Expand Down
6 changes: 5 additions & 1 deletion var/spack/repos/builtin/packages/of-catalyst/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ class OfCatalyst(CMakePackage):

depends_on("openfoam@1806", when="@1806", type=("build", "link", "run"))
depends_on("openfoam@develop", when="@develop", type=("build", "link", "run"))
depends_on("paraview@5.5:+osmesa~qt", when="+full")

with when("+full"):
depends_on("paraview@5.5: ~qt")
depends_on("gl")
requires("^[virtuals=gl] osmesa")

root_cmakelists_dir = "src/catalyst"

Expand Down
36 changes: 14 additions & 22 deletions var/spack/repos/builtin/packages/paraview/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):
variant("python", default=False, description="Enable Python support", when="@5.6:")
variant("fortran", default=False, description="Enable Fortran support")
variant("mpi", default=True, description="Enable MPI support")
variant("osmesa", default=False, description="Enable OSMesa support")
variant("egl", default=False, description="Enable EGL in the OpenGL library being used")
variant("qt", default=False, description="Enable Qt (gui) support")
variant("opengl2", default=True, description="Enable OpenGL2 backend")
variant("examples", default=False, description="Build examples")
Expand Down Expand Up @@ -187,16 +185,12 @@ class Paraview(CMakePackage, CudaPackage, ROCmPackage):

depends_on("gl@3.2:", when="+opengl2")
depends_on("gl@1.2:", when="~opengl2")
depends_on("glew", when="~egl")
depends_on("glew gl=egl", when="+egl")
depends_on("glew")

depends_on("osmesa", when="+osmesa")
for p in ["linux", "cray"]:
depends_on("glx", when="~egl ~osmesa platform={}".format(p))
depends_on("libxt", when="~egl ~osmesa platform={}".format(p))
conflicts("+qt", when="+osmesa")
conflicts("+qt", when="+egl")
conflicts("+egl", when="+osmesa")
depends_on("libxt", when=f"platform={p} ^[virtuals=gl] glx")

requires("^[virtuals=gl] glx", when="+qt", msg="Qt support requires GLX")

depends_on("ospray@2.1:2", when="+raytracing")
depends_on("openimagedenoise", when="+raytracing")
Expand Down Expand Up @@ -376,7 +370,7 @@ def flag_handler(self, name, flags):
if self.spec["hdf5"].satisfies("@1.12:"):
flags.append("-DH5_USE_110_API")

return (flags, None, None)
return flags, None, None

def setup_run_environment(self, env):
# paraview 5.5 and later
Expand Down Expand Up @@ -424,27 +418,25 @@ def cmake_args(self):

def variant_bool(feature, on="ON", off="OFF"):
"""Ternary for spec variant to ON/OFF string"""
if feature in spec:
if spec.satisfies(feature):
return on
return off

def nvariant_bool(feature):
"""Negated ternary for spec variant to OFF/ON string"""
return variant_bool(feature, on="OFF", off="ON")

def use_x11():
"""Return false if osmesa or egl are requested"""
if "+osmesa" in spec or "+egl" in spec:
return "OFF"
if spec.satisfies("platform=windows"):
if (
spec.satisfies("^[virtuals=gl] osmesa")
or spec.satisfies("^[virtuals=gl] egl")
or spec.satisfies("platform=windows")
):
return "OFF"
return "ON"

rendering = variant_bool("+opengl2", "OpenGL2", "OpenGL")
includes = variant_bool("+development_files")

cmake_args = [
"-DVTK_OPENGL_HAS_OSMESA:BOOL=%s" % variant_bool("+osmesa"),
"-DVTK_OPENGL_HAS_OSMESA:BOOL=%s" % variant_bool("^[virtuals=gl] osmesa"),
"-DVTK_USE_X:BOOL=%s" % use_x11(),
"-DPARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=%s" % includes,
"-DBUILD_TESTING:BOOL=OFF",
Expand All @@ -453,7 +445,7 @@ def use_x11():
self.define_from_variant("VISIT_BUILD_READER_Silo", "visitbridge"),
]

if "+egl" in spec:
if spec.satisfies("^[virtuals=gl] egl"):
cmake_args.append("-DVTK_OPENGL_HAS_EGL:BOOL=ON")

if spec.satisfies("@5.12:"):
Expand Down Expand Up @@ -530,7 +522,7 @@ def use_x11():

# The assumed qt version changed to QT5 (as of paraview 5.2.1),
# so explicitly specify which QT major version is actually being used
if "+qt" in spec:
if spec.satisfies("+qt"):
cmake_args.extend(["-DPARAVIEW_QT_VERSION=%s" % spec["qt"].version[0]])

if "+fortran" in spec:
Expand Down
Loading

0 comments on commit dc9a6c2

Please sign in to comment.