Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
easybuild-repository-public-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DEEP-SEA
easybuild-repository-public-release
Commits
d5b0ef1a
Commit
d5b0ef1a
authored
2 years ago
by
Sebastian Achilles
Browse files
Options
Downloads
Patches
Plain Diff
Update NVHPC easyblock
parent
4671d608
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Custom_EasyBlocks/nvhpc.py
+34
-66
34 additions, 66 deletions
Custom_EasyBlocks/nvhpc.py
with
34 additions
and
66 deletions
Custom_EasyBlocks/nvhpc.py
+
34
−
66
View file @
d5b0ef1a
...
@@ -104,15 +104,13 @@ class EB_NVHPC(PackedBinary):
...
@@ -104,15 +104,13 @@ class EB_NVHPC(PackedBinary):
# EULA for NVHPC must be accepted via --accept-eula-for EasyBuild configuration option,
# EULA for NVHPC must be accepted via --accept-eula-for EasyBuild configuration option,
# or via 'accept_eula = True' in easyconfig file
# or via 'accept_eula = True' in easyconfig file
self
.
check_accepted_eula
(
self
.
check_accepted_eula
(
more_info
=
'
https://docs.nvidia.com/hpc-sdk/eula/index.html
'
)
more_info
=
'
https://docs.nvidia.com/hpc-sdk/eula/index.html
'
)
default_cuda_version
=
self
.
cfg
[
'
default_cuda_version
'
]
default_cuda_version
=
self
.
cfg
[
'
default_cuda_version
'
]
if
default_cuda_version
is
None
:
if
default_cuda_version
is
None
:
module_cuda_version_full
=
get_software_version
(
'
CUDA
'
)
module_cuda_version_full
=
get_software_version
(
'
CUDA
'
)
if
module_cuda_version_full
is
not
None
:
if
module_cuda_version_full
is
not
None
:
default_cuda_version
=
'
.
'
.
join
(
default_cuda_version
=
'
.
'
.
join
(
module_cuda_version_full
.
split
(
'
.
'
)[:
2
])
module_cuda_version_full
.
split
(
'
.
'
)[:
2
])
else
:
else
:
error_msg
=
"
A default CUDA version is needed for installation of NVHPC.
"
error_msg
=
"
A default CUDA version is needed for installation of NVHPC.
"
error_msg
+=
"
It can not be determined automatically and needs to be added manually.
"
error_msg
+=
"
It can not be determined automatically and needs to be added manually.
"
...
@@ -122,8 +120,7 @@ class EB_NVHPC(PackedBinary):
...
@@ -122,8 +120,7 @@ class EB_NVHPC(PackedBinary):
# Parse default_compute_capability from different sources (CLI has priority)
# Parse default_compute_capability from different sources (CLI has priority)
ec_default_compute_capability
=
self
.
cfg
[
'
cuda_compute_capabilities
'
]
ec_default_compute_capability
=
self
.
cfg
[
'
cuda_compute_capabilities
'
]
cfg_default_compute_capability
=
build_option
(
cfg_default_compute_capability
=
build_option
(
'
cuda_compute_capabilities
'
)
'
cuda_compute_capabilities
'
)
if
cfg_default_compute_capability
is
not
None
:
if
cfg_default_compute_capability
is
not
None
:
default_compute_capability
=
cfg_default_compute_capability
default_compute_capability
=
cfg_default_compute_capability
elif
ec_default_compute_capability
and
ec_default_compute_capability
is
not
None
:
elif
ec_default_compute_capability
and
ec_default_compute_capability
is
not
None
:
...
@@ -138,16 +135,14 @@ class EB_NVHPC(PackedBinary):
...
@@ -138,16 +135,14 @@ class EB_NVHPC(PackedBinary):
if
isinstance
(
default_compute_capability
,
list
):
if
isinstance
(
default_compute_capability
,
list
):
_before_default_compute_capability
=
default_compute_capability
_before_default_compute_capability
=
default_compute_capability
default_compute_capability
=
_before_default_compute_capability
[
0
]
default_compute_capability
=
_before_default_compute_capability
[
0
]
warning_msg
=
"
Replaced list of compute capabilities {}
"
.
format
(
if
len
(
_before_default_compute_capability
)
>
1
:
_before_default_compute_capability
)
warning_msg
=
"
Replaced list of compute capabilities {}
"
.
format
(
_before_default_compute_capability
)
warning_msg
+=
"
with first element of list {}
"
.
format
(
warning_msg
+=
"
with first element of list: {}
"
.
format
(
default_compute_capability
)
default_compute_capability
)
print_warning
(
warning_msg
)
print_warning
(
warning_msg
)
# Remove dot-divider for CC; error out if it is not a string
# Remove dot-divider for CC; error out if it is not a string
if
isinstance
(
default_compute_capability
,
str
):
if
isinstance
(
default_compute_capability
,
str
):
default_compute_capability
=
default_compute_capability
.
replace
(
default_compute_capability
=
default_compute_capability
.
replace
(
'
.
'
,
''
)
'
.
'
,
''
)
else
:
else
:
raise
EasyBuildError
(
"
Unexpected non-string value encountered for compute capability: %s
"
,
raise
EasyBuildError
(
"
Unexpected non-string value encountered for compute capability: %s
"
,
default_compute_capability
)
default_compute_capability
)
...
@@ -156,24 +151,20 @@ class EB_NVHPC(PackedBinary):
...
@@ -156,24 +151,20 @@ class EB_NVHPC(PackedBinary):
'
NVHPC_INSTALL_DIR
'
:
self
.
installdir
,
'
NVHPC_INSTALL_DIR
'
:
self
.
installdir
,
'
NVHPC_SILENT
'
:
'
true
'
,
'
NVHPC_SILENT
'
:
'
true
'
,
'
NVHPC_DEFAULT_CUDA
'
:
str
(
default_cuda_version
),
# 10.2, 11.0
'
NVHPC_DEFAULT_CUDA
'
:
str
(
default_cuda_version
),
# 10.2, 11.0
# 70, 80; single value, no list!
'
NVHPC_STDPAR_CUDACC
'
:
str
(
default_compute_capability
),
# 70, 80; single value, no list!
'
NVHPC_STDPAR_CUDACC
'
:
str
(
default_compute_capability
),
}
}
cmd
=
"
%s ./install
"
%
'
'
.
join
([
'
%s=%s
'
%
cmd
=
"
%s ./install
"
%
'
'
.
join
([
'
%s=%s
'
%
x
for
x
in
sorted
(
nvhpc_env_vars
.
items
())])
x
for
x
in
sorted
(
nvhpc_env_vars
.
items
())])
run_cmd
(
cmd
,
log_all
=
True
,
simple
=
True
)
run_cmd
(
cmd
,
log_all
=
True
,
simple
=
True
)
# make sure localrc uses GCC in PATH, not always the system GCC, and does not use a system g77 but gfortran
# make sure localrc uses GCC in PATH, not always the system GCC, and does not use a system g77 but gfortran
install_abs_subdir
=
os
.
path
.
join
(
install_abs_subdir
=
os
.
path
.
join
(
self
.
installdir
,
self
.
nvhpc_install_subdir
)
self
.
installdir
,
self
.
nvhpc_install_subdir
)
compilers_subdir
=
os
.
path
.
join
(
install_abs_subdir
,
"
compilers
"
)
compilers_subdir
=
os
.
path
.
join
(
install_abs_subdir
,
"
compilers
"
)
makelocalrc_filename
=
os
.
path
.
join
(
makelocalrc_filename
=
os
.
path
.
join
(
compilers_subdir
,
"
bin
"
,
"
makelocalrc
"
)
compilers_subdir
,
"
bin
"
,
"
makelocalrc
"
)
for
line
in
fileinput
.
input
(
makelocalrc_filename
,
inplace
=
'
1
'
,
backup
=
'
.orig
'
):
for
line
in
fileinput
.
input
(
makelocalrc_filename
,
inplace
=
'
1
'
,
backup
=
'
.orig
'
):
line
=
re
.
sub
(
r
"
^PATH=/
"
,
r
"
#PATH=/
"
,
line
)
line
=
re
.
sub
(
r
"
^PATH=/
"
,
r
"
#PATH=/
"
,
line
)
sys
.
stdout
.
write
(
line
)
sys
.
stdout
.
write
(
line
)
cmd
=
"
%s -x %s -g77
/
"
%
(
makelocalrc_filename
,
compilers_subdir
)
cmd
=
"
%s -x %s -g77
gfortran
"
%
(
makelocalrc_filename
,
compilers_subdir
)
run_cmd
(
cmd
,
log_all
=
True
,
simple
=
True
)
run_cmd
(
cmd
,
log_all
=
True
,
simple
=
True
)
# If an OS libnuma is NOT found, makelocalrc creates symbolic links to libpgnuma.so
# If an OS libnuma is NOT found, makelocalrc creates symbolic links to libpgnuma.so
...
@@ -192,16 +183,14 @@ class EB_NVHPC(PackedBinary):
...
@@ -192,16 +183,14 @@ class EB_NVHPC(PackedBinary):
siterc_path
,
SITERC_LIBRARY_PATH
)
siterc_path
,
SITERC_LIBRARY_PATH
)
# The cuda nvvp tar file has broken permissions
# The cuda nvvp tar file has broken permissions
adjust_permissions
(
self
.
installdir
,
stat
.
S_IWUSR
,
adjust_permissions
(
self
.
installdir
,
stat
.
S_IWUSR
,
add
=
True
,
onlydirs
=
True
)
add
=
True
,
onlydirs
=
True
)
def
sanity_check_step
(
self
):
def
sanity_check_step
(
self
):
"""
Custom sanity check for NVHPC
"""
"""
Custom sanity check for NVHPC
"""
prefix
=
self
.
nvhpc_install_subdir
prefix
=
self
.
nvhpc_install_subdir
compiler_names
=
[
'
nvc
'
,
'
nvc++
'
,
'
nvfortran
'
]
compiler_names
=
[
'
nvc
'
,
'
nvc++
'
,
'
nvfortran
'
]
files
=
[
os
.
path
.
join
(
prefix
,
'
compilers
'
,
'
bin
'
,
x
)
files
=
[
os
.
path
.
join
(
prefix
,
'
compilers
'
,
'
bin
'
,
x
)
for
x
in
compiler_names
]
for
x
in
compiler_names
]
if
LooseVersion
(
self
.
version
)
<
LooseVersion
(
'
21.3
'
):
if
LooseVersion
(
self
.
version
)
<
LooseVersion
(
'
21.3
'
):
files
.
append
(
os
.
path
.
join
(
prefix
,
'
compilers
'
,
'
bin
'
,
'
siterc
'
))
files
.
append
(
os
.
path
.
join
(
prefix
,
'
compilers
'
,
'
bin
'
,
'
siterc
'
))
...
@@ -211,8 +200,7 @@ class EB_NVHPC(PackedBinary):
...
@@ -211,8 +200,7 @@ class EB_NVHPC(PackedBinary):
os
.
path
.
join
(
prefix
,
'
compilers
'
,
'
include
'
),
os
.
path
.
join
(
prefix
,
'
compilers
'
,
'
man
'
)]
os
.
path
.
join
(
prefix
,
'
compilers
'
,
'
include
'
),
os
.
path
.
join
(
prefix
,
'
compilers
'
,
'
man
'
)]
}
}
custom_commands
=
[
"
%s -v
"
%
compiler
for
compiler
in
compiler_names
]
custom_commands
=
[
"
%s -v
"
%
compiler
for
compiler
in
compiler_names
]
super
(
EB_NVHPC
,
self
).
sanity_check_step
(
super
(
EB_NVHPC
,
self
).
sanity_check_step
(
custom_paths
=
custom_paths
,
custom_commands
=
custom_commands
)
custom_paths
=
custom_paths
,
custom_commands
=
custom_commands
)
def
_nvhpc_extended_components
(
self
,
dirs
,
basepath
,
env_vars_dirs
):
def
_nvhpc_extended_components
(
self
,
dirs
,
basepath
,
env_vars_dirs
):
"""
"""
...
@@ -232,8 +220,7 @@ class EB_NVHPC(PackedBinary):
...
@@ -232,8 +220,7 @@ class EB_NVHPC(PackedBinary):
"""
Prefix subdirectories in NVHPC install dir considered for environment variables defined in module file.
"""
"""
Prefix subdirectories in NVHPC install dir considered for environment variables defined in module file.
"""
dirs
=
super
(
EB_NVHPC
,
self
).
make_module_req_guess
()
dirs
=
super
(
EB_NVHPC
,
self
).
make_module_req_guess
()
for
key
in
dirs
:
for
key
in
dirs
:
dirs
[
key
]
=
[
os
.
path
.
join
(
dirs
[
key
]
=
[
os
.
path
.
join
(
self
.
nvhpc_install_subdir
,
'
compilers
'
,
d
)
for
d
in
dirs
[
key
]]
self
.
nvhpc_install_subdir
,
'
compilers
'
,
d
)
for
d
in
dirs
[
key
]]
# $CPATH should not be defined in module for NVHPC, it causes problems
# $CPATH should not be defined in module for NVHPC, it causes problems
# cfr. https://github.com/easybuilders/easybuild-easyblocks/issues/830
# cfr. https://github.com/easybuilders/easybuild-easyblocks/issues/830
...
@@ -251,91 +238,72 @@ class EB_NVHPC(PackedBinary):
...
@@ -251,91 +238,72 @@ class EB_NVHPC(PackedBinary):
# NVHPC is shipped with a compiled OpenMPI installation
# NVHPC is shipped with a compiled OpenMPI installation
# Enable it by setting according environment variables
# Enable it by setting according environment variables
if
self
.
cfg
[
'
module_nvhpc_own_mpi
'
]:
if
self
.
cfg
[
'
module_nvhpc_own_mpi
'
]:
self
.
nvhpc_mpi_basedir
=
os
.
path
.
join
(
self
.
nvhpc_mpi_basedir
=
os
.
path
.
join
(
self
.
nvhpc_install_subdir
,
"
comm_libs
"
,
"
mpi
"
)
self
.
nvhpc_install_subdir
,
"
comm_libs
"
,
"
mpi
"
)
env_vars_dirs
=
{
env_vars_dirs
=
{
'
PATH
'
:
'
bin
'
,
'
PATH
'
:
'
bin
'
,
'
CPATH
'
:
'
include
'
,
'
CPATH
'
:
'
include
'
,
'
LD_LIBRARY_PATH
'
:
'
lib
'
'
LD_LIBRARY_PATH
'
:
'
lib
'
}
}
self
.
_nvhpc_extended_components
(
self
.
_nvhpc_extended_components
(
dirs
,
self
.
nvhpc_mpi_basedir
,
env_vars_dirs
)
dirs
,
self
.
nvhpc_mpi_basedir
,
env_vars_dirs
)
# Math Libraries:
# Math Libraries:
# NVHPC is shipped with math libraries (in a dedicated folder)
# NVHPC is shipped with math libraries (in a dedicated folder)
# Enable them by setting according environment variables
# Enable them by setting according environment variables
if
self
.
cfg
[
'
module_add_math_libs
'
]:
if
self
.
cfg
[
'
module_add_math_libs
'
]:
self
.
nvhpc_math_basedir
=
os
.
path
.
join
(
self
.
nvhpc_math_basedir
=
os
.
path
.
join
(
self
.
nvhpc_install_subdir
,
"
math_libs
"
)
self
.
nvhpc_install_subdir
,
"
math_libs
"
)
env_vars_dirs
=
{
env_vars_dirs
=
{
'
CPATH
'
:
'
include
'
,
'
CPATH
'
:
'
include
'
,
'
LD_LIBRARY_PATH
'
:
'
lib64
'
'
LD_LIBRARY_PATH
'
:
'
lib64
'
}
}
self
.
_nvhpc_extended_components
(
self
.
_nvhpc_extended_components
(
dirs
,
self
.
nvhpc_math_basedir
,
env_vars_dirs
)
dirs
,
self
.
nvhpc_math_basedir
,
env_vars_dirs
)
# GPU Profilers:
# GPU Profilers:
# NVHPC is shipped with NVIDIA's GPU profilers (Nsight Compute/Nsight Systems)
# NVHPC is shipped with NVIDIA's GPU profilers (Nsight Compute/Nsight Systems)
# Enable them by setting the according environment variables
# Enable them by setting the according environment variables
if
self
.
cfg
[
'
module_add_profilers
'
]:
if
self
.
cfg
[
'
module_add_profilers
'
]:
self
.
nvhpc_profilers_basedir
=
os
.
path
.
join
(
self
.
nvhpc_profilers_basedir
=
os
.
path
.
join
(
self
.
nvhpc_install_subdir
,
"
profilers
"
)
self
.
nvhpc_install_subdir
,
"
profilers
"
)
env_vars_dirs
=
{
env_vars_dirs
=
{
'
PATH
'
:
[
'
Nsight_Compute
'
,
'
Nsight_Systems/bin
'
]
'
PATH
'
:
[
'
Nsight_Compute
'
,
'
Nsight_Systems/bin
'
]
}
}
self
.
_nvhpc_extended_components
(
self
.
_nvhpc_extended_components
(
dirs
,
self
.
nvhpc_profilers_basedir
,
env_vars_dirs
)
dirs
,
self
.
nvhpc_profilers_basedir
,
env_vars_dirs
)
# NCCL:
# NCCL:
# NVHPC is shipped with NCCL
# NVHPC is shipped with NCCL
# Enable it by setting the according environment variables
# Enable it by setting the according environment variables
if
self
.
cfg
[
'
module_add_nccl
'
]:
if
self
.
cfg
[
'
module_add_nccl
'
]:
self
.
nvhpc_nccl_basedir
=
os
.
path
.
join
(
self
.
nvhpc_nccl_basedir
=
os
.
path
.
join
(
self
.
nvhpc_install_subdir
,
"
comm_libs
"
,
"
nccl
"
)
self
.
nvhpc_install_subdir
,
"
comm_libs
"
,
"
nccl
"
)
env_vars_dirs
=
{
env_vars_dirs
=
{
'
CPATH
'
:
'
include
'
,
'
CPATH
'
:
'
include
'
,
'
LD_LIBRARY_PATH
'
:
'
lib
'
'
LD_LIBRARY_PATH
'
:
'
lib
'
}
}
self
.
_nvhpc_extended_components
(
self
.
_nvhpc_extended_components
(
dirs
,
self
.
nvhpc_nccl_basedir
,
env_vars_dirs
)
dirs
,
self
.
nvhpc_nccl_basedir
,
env_vars_dirs
)
# NVSHMEM:
# NVSHMEM:
# NVHPC is shipped with NVSHMEM
# NVHPC is shipped with NVSHMEM
# Enable it by setting the according environment variables
# Enable it by setting the according environment variables
if
self
.
cfg
[
'
module_add_nvshmem
'
]:
if
self
.
cfg
[
'
module_add_nvshmem
'
]:
self
.
nvhpc_nvshmem_basedir
=
os
.
path
.
join
(
self
.
nvhpc_nvshmem_basedir
=
os
.
path
.
join
(
self
.
nvhpc_install_subdir
,
"
comm_libs
"
,
"
nvshmem
"
)
self
.
nvhpc_install_subdir
,
"
comm_libs
"
,
"
nvshmem
"
)
env_vars_dirs
=
{
env_vars_dirs
=
{
'
CPATH
'
:
'
include
'
,
'
CPATH
'
:
'
include
'
,
'
LD_LIBRARY_PATH
'
:
'
lib
'
'
LD_LIBRARY_PATH
'
:
'
lib
'
}
}
self
.
_nvhpc_extended_components
(
self
.
_nvhpc_extended_components
(
dirs
,
self
.
nvhpc_nvshmem_basedir
,
env_vars_dirs
)
dirs
,
self
.
nvhpc_nvshmem_basedir
,
env_vars_dirs
)
# CUDA:
# CUDA:
# NVHPC is shipped with CUDA (possibly multiple versions)
# NVHPC is shipped with CUDA (possibly multiple versions)
# Rather use this CUDA than an external CUDA (via $CUDA_HOME) by setting according environment variables
# Rather use this CUDA than an external CUDA (via $CUDA_HOME) by setting according environment variables
if
self
.
cfg
[
'
module_add_cuda
'
]:
if
self
.
cfg
[
'
module_add_cuda
'
]:
self
.
nvhpc_cuda_basedir
=
os
.
path
.
join
(
self
.
nvhpc_cuda_basedir
=
os
.
path
.
join
(
self
.
nvhpc_install_subdir
,
"
cuda
"
)
self
.
nvhpc_install_subdir
,
"
cuda
"
)
env_vars_dirs
=
{
env_vars_dirs
=
{
'
PATH
'
:
'
bin
'
,
'
PATH
'
:
'
bin
'
,
'
LD_LIBRARY_PATH
'
:
'
lib64
'
,
'
LD_LIBRARY_PATH
'
:
'
lib64
'
,
'
CPATH
'
:
'
include
'
'
CPATH
'
:
'
include
'
}
}
self
.
_nvhpc_extended_components
(
self
.
_nvhpc_extended_components
(
dirs
,
self
.
nvhpc_cuda_basedir
,
env_vars_dirs
)
dirs
,
self
.
nvhpc_cuda_basedir
,
env_vars_dirs
)
return
dirs
return
dirs
def
make_module_extra
(
self
):
def
make_module_extra
(
self
):
"""
Add environment variable for NVHPC location
"""
"""
Add environment variable for NVHPC location
"""
txt
=
super
(
EB_NVHPC
,
self
).
make_module_extra
()
txt
=
super
(
EB_NVHPC
,
self
).
make_module_extra
()
txt
+=
self
.
module_generator
.
set_environment
(
'
NVHPC
'
,
self
.
installdir
)
txt
+=
self
.
module_generator
.
set_environment
(
'
NVHPC
'
,
self
.
installdir
)
# NVHPC 22.7+ requires the variable NVHPC_CUDA_HOME for external CUDA. CUDA_HOME has been deprecated.
if
LooseVersion
(
self
.
version
)
>=
LooseVersion
(
'
22.7
'
):
if
LooseVersion
(
self
.
version
)
>=
LooseVersion
(
'
22.7
'
):
# If CUDA is not available then avoid setting NVHPC_CUDA_HOME altogether
# NVHPC 22.7+ requires the variable NVHPC_CUDA_HOME for external CUDA. CUDA_HOME has been deprecated.
# and rely on the internal one
if
not
self
.
cfg
[
'
module_add_cuda
'
]
and
get_software_root
(
'
CUDA
'
):
if
not
self
.
cfg
[
'
module_add_cuda
'
]:
txt
+=
self
.
module_generator
.
set_environment
(
'
NVHPC_CUDA_HOME
'
,
os
.
getenv
(
'
CUDA_HOME
'
))
cuda
=
get_software_root
(
'
CUDA
'
)
if
cuda
:
txt
+=
self
.
module_generator
.
set_environment
(
'
NVHPC_CUDA_HOME
'
,
cuda
)
else
:
raise
EasyBuildError
(
"
No external CUDA available and opting-out of internal CUDA. Don
'
t know what to do
"
)
return
txt
return
txt
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment