Skip to content

GPU CUDA variant of ISSM#35

Draft
justinh2002 wants to merge 13 commits into
access-developmentfrom
justinh2002/GPU_cuda
Draft

GPU CUDA variant of ISSM#35
justinh2002 wants to merge 13 commits into
access-developmentfrom
justinh2002/GPU_cuda

Conversation

@justinh2002

@justinh2002 justinh2002 commented May 29, 2026

Copy link
Copy Markdown
Collaborator

ISSM — GPU/CUDA support

https://github.com/ACCESS-NRI/ISSM

Four files modified/created:

File What
externalpackages/petsc/install-3.22-gadi-gpu.sh New script: builds PETSc 3.22 with --with-cuda, installs to install-gpu/ alongside the CPU install
src/m/classes/gpuoptions.py New class: drop-in md.toolkits.DefaultAnalysis = gpuoptions() that sets vec_type=cuda, mat_type=aijcusparse, GMRES+block-Jacobi
configure.sh Added gpu step: loads CUDA module, builds GPU PETSc if needed, then configures ISSM against it
toolkits/petsc/patches/NewMat.cpp Fixed strcmp(type,"mpiaij")strncmp(type,"mpiaij",6) so CUDA matrix type mpiaijcusparse also gets preallocated

Spack package — +cuda variant

packages/issm/package.py updated:

  • Added CudaPackage mixin → provides +cuda variant and cuda_arch values automatically
  • Refactored PETSc dependencies into ~cuda/+cuda pairs so spack install issm +cuda cuda_arch=70 propagates +cuda cuda_arch=70 down to PETSc
  • Added conflict: +cuda +ad is rejected

@justinh2002 justinh2002 changed the title change dims CUDA variant of ISSM May 29, 2026
@justinh2002 justinh2002 changed the title CUDA variant of ISSM GPU CUDA variant of ISSM May 29, 2026
In +ad builds PVec resolves to adjoint_petsc::ADVec (ADVecImpl*) which
is not compatible with VecScatterCreate*/VecGetArrayRead — those APIs
only accept plain Vec.

+cuda and +ad are mutually exclusive (Spack conflict), so:
  _HAVE_PETSC_CUDA_ defined  -> scatter / VecGetArrayRead (Vec only)
  _HAVE_PETSC_CUDA_ not set  -> original VecGetValues path (handles ADVec)

Fixes CI failure in gcc-ad build (PR #35).
@justinh2002 justinh2002 marked this pull request as draft June 2, 2026 03:19
The strncmp commit accidentally dropped the preallocation call, closing
braces and return statement, leaving only the fold marker. Restore them.
@justinh2002

Copy link
Copy Markdown
Collaborator Author

!redeploy

@justinh2002 justinh2002 self-assigned this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant