From eb3c243ac2448ab8b8ae39ab4e4708f798b10017 Mon Sep 17 00:00:00 2001 From: He-Feng Hsieh Date: Thu, 13 Nov 2025 15:56:08 +0800 Subject: [PATCH 1/6] Support passing maxrregcount argument to configure.py --- src/configure.py | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/configure.py b/src/configure.py index 4a8a8e215e..d2ca19ac6f 100755 --- a/src/configure.py +++ b/src/configure.py @@ -836,6 +836,12 @@ def load_arguments( sys_setting : SystemSetting ): help="Enable GPU. Must set in your machine *.config file as well.\n" ) + parser.add_argument( "--gpu_regcount", type=int, metavar="INTEGER", + default=None, + depend={"gpu":True}, + help="Set the maximum amount of registers that GPU functions can use.\n" + ) + args, name_table, depends, constraints, prefix_table, suffix_table = parser.parse_args() args = vars( args ) @@ -943,16 +949,19 @@ def set_gpu( gpus, flags, args ): gpu_opts["NVCCFLAG_ARCH"] = '-gencode arch=compute_%d,code=\\"compute_%d,sm_%d\\"'%(flag_num, flag_num, flag_num) # 3. Set MAXRREGCOUNT_FLU - if 300 <= compute_capability and compute_capability <= 370: - if args["double"]: - gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=128" - else: - gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=70" - elif 500 <= compute_capability and compute_capability <= 900: - if args["double"]: - gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=192" - else: - gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=128" + if args["gpu_regcount"] is not None: + gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=%d"%(args["gpu_regcount"]) + else: + if 300 <= compute_capability and compute_capability <= 370: + if args["double"]: + gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=128" + else: + gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=70" + elif 500 <= compute_capability and compute_capability <= 900: + if args["double"]: + gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=192" + else: + gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=128" return gpu_opts def set_sims( name_table, prefix_table, suffix_table, depends, **kwargs ): @@ -1094,6 +1103,11 @@ def validation( paths, depends, constraints, **kwargs ): LOGGER.error("<--rng=RNG_CPP11> is required for macOS.") success = False + # C. parallelization and flags + if kwargs["gpu"] and kwargs["gpu_regcount"] is not None and kwargs["gpu_regcount"] <= 0: + LOGGER.error("<--gpu_regcount> must be a positive integer. Current: %d"%kwargs["gpu_regcount"]) + success = False + if not success: raise BaseException( "The above vaildation failed." ) return From 823e22cd3fe352156d38d7d59f103d1d365274e6 Mon Sep 17 00:00:00 2001 From: He-Feng Hsieh Date: Thu, 13 Nov 2025 16:18:05 +0800 Subject: [PATCH 2/6] Update wiki --- doc/wiki/GPU.md | 1 + .../Installation-related/Installation:-Option-List.md | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/wiki/GPU.md b/doc/wiki/GPU.md index e80162cff8..fada1c769e 100644 --- a/doc/wiki/GPU.md +++ b/doc/wiki/GPU.md @@ -18,6 +18,7 @@ according to the GPU architecture on your system in the [[configuration file | I Related options: [[--gpu | Installation:-Option-List#--gpu]],   +[[--gpu_regcount | Installation:-Option-List#--gpu_regcount]],   ## Runtime Parameters diff --git a/doc/wiki/Installation-related/Installation:-Option-List.md b/doc/wiki/Installation-related/Installation:-Option-List.md index b832283fd6..95454137d3 100644 --- a/doc/wiki/Installation-related/Installation:-Option-List.md +++ b/doc/wiki/Installation-related/Installation:-Option-List.md @@ -111,10 +111,11 @@ disabled). See the "Restriction" of each option carefully. |                               
Option
                               |           
Value
           |           
Default
           |                                                   
Description
                                                   |                                                   
Restriction
                                                   | Corresponding symbolic constant | |:---:|:---:|:---:|---|---|---| -| `--openmp` | `true`, `false` | `true` | Enable OpenMP (see [[MPI and OpenMP]]) | Must set the compilation flag `OPENMPFLAG` in [[configuration file \| Installation:-Machine-Configuration-File#3-Compilation-flags]] | `OPENMP` | -| `--mpi` | `true`, `false` | `false` | `true`: Enable load balancing using a space-filling curve (see [[MPI and OpenMP]]); `false`: Run GAMER in a serial mode, but OpenMP is still supported | May need to set `MPI_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `LOAD_BALANCE=HILBERT`, `SERIAL` | -| `--overlap_mpi` | `true`, `false` | `false` | Overlap MPI communication with computation. | Not supported yet!!! Must enable `--mpi`. | `OVERLAP_MPI` | -| `--gpu` | `true`, `false` | `false` | Enable GPU acceleration | Must specify `GPU_COMPUTE_CAPABILITY` and may need to set `CUDA_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `GPU` | +| `--openmp` | `true`, `false` | `true` | Enable OpenMP (see [[MPI and OpenMP]]) | Must set the compilation flag `OPENMPFLAG` in [[configuration file \| Installation:-Machine-Configuration-File#3-Compilation-flags]] | `OPENMP` | +| `--mpi` | `true`, `false` | `false` | `true`: Enable load balancing using a space-filling curve (see [[MPI and OpenMP]]); `false`: Run GAMER in a serial mode, but OpenMP is still supported | May need to set `MPI_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `LOAD_BALANCE=HILBERT`, `SERIAL` | +| `--overlap_mpi` | `true`, `false` | `false` | Overlap MPI communication with computation. | Not supported yet!!! Must enable `--mpi`. | `OVERLAP_MPI` | +| `--gpu` | `true`, `false` | `false` | Enable GPU acceleration | Must specify `GPU_COMPUTE_CAPABILITY` and may need to set `CUDA_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `GPU` | +| `--gpu_regcount` | > 0 | Depend | Set the maximum amount of registers that GPU functions can use. | Must be a positive integer. | | ## Miscellaneous Options From fcb76071a8147b4547a171caa4dd4fd7c30fd879 Mon Sep 17 00:00:00 2001 From: He-Feng Hsieh Date: Thu, 13 Nov 2025 23:52:35 +0800 Subject: [PATCH 3/6] Rename gpu_regcount to gpu_regcount_flu --- doc/wiki/GPU.md | 2 +- .../Installation-related/Installation:-Option-List.md | 10 +++++----- src/configure.py | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/wiki/GPU.md b/doc/wiki/GPU.md index fada1c769e..9dbb656582 100644 --- a/doc/wiki/GPU.md +++ b/doc/wiki/GPU.md @@ -18,7 +18,7 @@ according to the GPU architecture on your system in the [[configuration file | I Related options: [[--gpu | Installation:-Option-List#--gpu]],   -[[--gpu_regcount | Installation:-Option-List#--gpu_regcount]],   +[[--gpu_regcount_flu | Installation:-Option-List#--gpu_regcount_flu]],   ## Runtime Parameters diff --git a/doc/wiki/Installation-related/Installation:-Option-List.md b/doc/wiki/Installation-related/Installation:-Option-List.md index 95454137d3..b250b78022 100644 --- a/doc/wiki/Installation-related/Installation:-Option-List.md +++ b/doc/wiki/Installation-related/Installation:-Option-List.md @@ -111,11 +111,11 @@ disabled). See the "Restriction" of each option carefully. |                               
Option
                               |           
Value
           |           
Default
           |                                                   
Description
                                                   |                                                   
Restriction
                                                   | Corresponding symbolic constant | |:---:|:---:|:---:|---|---|---| -| `--openmp` | `true`, `false` | `true` | Enable OpenMP (see [[MPI and OpenMP]]) | Must set the compilation flag `OPENMPFLAG` in [[configuration file \| Installation:-Machine-Configuration-File#3-Compilation-flags]] | `OPENMP` | -| `--mpi` | `true`, `false` | `false` | `true`: Enable load balancing using a space-filling curve (see [[MPI and OpenMP]]); `false`: Run GAMER in a serial mode, but OpenMP is still supported | May need to set `MPI_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `LOAD_BALANCE=HILBERT`, `SERIAL` | -| `--overlap_mpi` | `true`, `false` | `false` | Overlap MPI communication with computation. | Not supported yet!!! Must enable `--mpi`. | `OVERLAP_MPI` | -| `--gpu` | `true`, `false` | `false` | Enable GPU acceleration | Must specify `GPU_COMPUTE_CAPABILITY` and may need to set `CUDA_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `GPU` | -| `--gpu_regcount` | > 0 | Depend | Set the maximum amount of registers that GPU functions can use. | Must be a positive integer. | | +| `--openmp` | `true`, `false` | `true` | Enable OpenMP (see [[MPI and OpenMP]]) | Must set the compilation flag `OPENMPFLAG` in [[configuration file \| Installation:-Machine-Configuration-File#3-Compilation-flags]] | `OPENMP` | +| `--mpi` | `true`, `false` | `false` | `true`: Enable load balancing using a space-filling curve (see [[MPI and OpenMP]]); `false`: Run GAMER in a serial mode, but OpenMP is still supported | May need to set `MPI_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `LOAD_BALANCE=HILBERT`, `SERIAL` | +| `--overlap_mpi` | `true`, `false` | `false` | Overlap MPI communication with computation. | Not supported yet!!! Must enable `--mpi`. | `OVERLAP_MPI` | +| `--gpu` | `true`, `false` | `false` | Enable GPU acceleration | Must specify `GPU_COMPUTE_CAPABILITY` and may need to set `CUDA_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `GPU` | +| `--gpu_regcount_flu` | > 0 | Depend | Set the maximum amount of registers that GPU functions can use. | Must be a positive integer. | | ## Miscellaneous Options diff --git a/src/configure.py b/src/configure.py index d2ca19ac6f..e4407ccdb3 100755 --- a/src/configure.py +++ b/src/configure.py @@ -836,7 +836,7 @@ def load_arguments( sys_setting : SystemSetting ): help="Enable GPU. Must set in your machine *.config file as well.\n" ) - parser.add_argument( "--gpu_regcount", type=int, metavar="INTEGER", + parser.add_argument( "--gpu_regcount_flu", type=int, metavar="INTEGER", default=None, depend={"gpu":True}, help="Set the maximum amount of registers that GPU functions can use.\n" @@ -949,8 +949,8 @@ def set_gpu( gpus, flags, args ): gpu_opts["NVCCFLAG_ARCH"] = '-gencode arch=compute_%d,code=\\"compute_%d,sm_%d\\"'%(flag_num, flag_num, flag_num) # 3. Set MAXRREGCOUNT_FLU - if args["gpu_regcount"] is not None: - gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=%d"%(args["gpu_regcount"]) + if args["gpu_regcount_flu"] is not None: + gpu_opts["MAXRREGCOUNT_FLU"] = "--maxrregcount=%d"%(args["gpu_regcount_flu"]) else: if 300 <= compute_capability and compute_capability <= 370: if args["double"]: @@ -1104,8 +1104,8 @@ def validation( paths, depends, constraints, **kwargs ): success = False # C. parallelization and flags - if kwargs["gpu"] and kwargs["gpu_regcount"] is not None and kwargs["gpu_regcount"] <= 0: - LOGGER.error("<--gpu_regcount> must be a positive integer. Current: %d"%kwargs["gpu_regcount"]) + if kwargs["gpu"] and kwargs["gpu_regcount_flu"] is not None and kwargs["gpu_regcount_flu"] <= 0: + LOGGER.error("<--gpu_regcount_flu> must be a positive integer. Current: %d"%kwargs["gpu_regcount_flu"]) success = False if not success: raise BaseException( "The above vaildation failed." ) From 5d6407c194c5eb9b78a427cfa207b4ed46585c01 Mon Sep 17 00:00:00 2001 From: He-Feng Hsieh Date: Thu, 13 Nov 2025 23:55:45 +0800 Subject: [PATCH 4/6] Minor --- doc/wiki/Installation-related/Installation:-Option-List.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/wiki/Installation-related/Installation:-Option-List.md b/doc/wiki/Installation-related/Installation:-Option-List.md index b250b78022..2f04a8f781 100644 --- a/doc/wiki/Installation-related/Installation:-Option-List.md +++ b/doc/wiki/Installation-related/Installation:-Option-List.md @@ -112,7 +112,7 @@ disabled). See the "Restriction" of each option carefully. |                               
Option
                               |           
Value
           |           
Default
           |                                                   
Description
                                                   |                                                   
Restriction
                                                   | Corresponding symbolic constant | |:---:|:---:|:---:|---|---|---| | `--openmp` | `true`, `false` | `true` | Enable OpenMP (see [[MPI and OpenMP]]) | Must set the compilation flag `OPENMPFLAG` in [[configuration file \| Installation:-Machine-Configuration-File#3-Compilation-flags]] | `OPENMP` | -| `--mpi` | `true`, `false` | `false` | `true`: Enable load balancing using a space-filling curve (see [[MPI and OpenMP]]); `false`: Run GAMER in a serial mode, but OpenMP is still supported | May need to set `MPI_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `LOAD_BALANCE=HILBERT`, `SERIAL` | +| `--mpi` | `true`, `false` | `false` | `true`: Enable load balancing using a space-filling curve (see [[MPI and OpenMP]]); `false`: Run GAMER in a serial mode, but OpenMP is still supported | May need to set `MPI_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `LOAD_BALANCE=HILBERT`, `SERIAL` | | `--overlap_mpi` | `true`, `false` | `false` | Overlap MPI communication with computation. | Not supported yet!!! Must enable `--mpi`. | `OVERLAP_MPI` | | `--gpu` | `true`, `false` | `false` | Enable GPU acceleration | Must specify `GPU_COMPUTE_CAPABILITY` and may need to set `CUDA_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `GPU` | | `--gpu_regcount_flu` | > 0 | Depend | Set the maximum amount of registers that GPU functions can use. | Must be a positive integer. | | From 6907ecf3d40221850549b01db03fde396c65c98c Mon Sep 17 00:00:00 2001 From: He-Feng Hsieh Date: Fri, 14 Nov 2025 12:56:10 +0800 Subject: [PATCH 5/6] Minor --- doc/wiki/GPU.md | 2 +- doc/wiki/Installation-related/Installation:-Option-List.md | 2 +- src/configure.py | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/wiki/GPU.md b/doc/wiki/GPU.md index 9dbb656582..75a0f73586 100644 --- a/doc/wiki/GPU.md +++ b/doc/wiki/GPU.md @@ -18,7 +18,7 @@ according to the GPU architecture on your system in the [[configuration file | I Related options: [[--gpu | Installation:-Option-List#--gpu]],   -[[--gpu_regcount_flu | Installation:-Option-List#--gpu_regcount_flu]],   +[[--gpu_regcount_flu | Installation:-Option-List#--gpu_regcount_flu]]   ## Runtime Parameters diff --git a/doc/wiki/Installation-related/Installation:-Option-List.md b/doc/wiki/Installation-related/Installation:-Option-List.md index 2f04a8f781..e137d5e793 100644 --- a/doc/wiki/Installation-related/Installation:-Option-List.md +++ b/doc/wiki/Installation-related/Installation:-Option-List.md @@ -115,7 +115,7 @@ disabled). See the "Restriction" of each option carefully. | `--mpi` | `true`, `false` | `false` | `true`: Enable load balancing using a space-filling curve (see [[MPI and OpenMP]]); `false`: Run GAMER in a serial mode, but OpenMP is still supported | May need to set `MPI_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `LOAD_BALANCE=HILBERT`, `SERIAL` | | `--overlap_mpi` | `true`, `false` | `false` | Overlap MPI communication with computation. | Not supported yet!!! Must enable `--mpi`. | `OVERLAP_MPI` | | `--gpu` | `true`, `false` | `false` | Enable GPU acceleration | Must specify `GPU_COMPUTE_CAPABILITY` and may need to set `CUDA_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `GPU` | -| `--gpu_regcount_flu` | > 0 | Depend | Set the maximum amount of registers that GPU functions can use. | Must be a positive integer. | | +| `--gpu_regcount_flu` | > 0 | Depend | Set the maximum amount of registers that GPU functions can use. | Must be a positive integer. | | ## Miscellaneous Options diff --git a/src/configure.py b/src/configure.py index e4407ccdb3..845c4b385c 100755 --- a/src/configure.py +++ b/src/configure.py @@ -1104,9 +1104,10 @@ def validation( paths, depends, constraints, **kwargs ): success = False # C. parallelization and flags - if kwargs["gpu"] and kwargs["gpu_regcount_flu"] is not None and kwargs["gpu_regcount_flu"] <= 0: - LOGGER.error("<--gpu_regcount_flu> must be a positive integer. Current: %d"%kwargs["gpu_regcount_flu"]) - success = False + if kwargs["gpu"]: + if kwargs["gpu_regcount_flu"] is not None and kwargs["gpu_regcount_flu"] <= 0: + LOGGER.error("<--gpu_regcount_flu> must be a positive integer. Current: %d"%kwargs["gpu_regcount_flu"]) + success = False if not success: raise BaseException( "The above vaildation failed." ) return From 4620d6176247428e1c4841125e8f25fe04736627 Mon Sep 17 00:00:00 2001 From: He-Feng Hsieh Date: Fri, 14 Nov 2025 14:00:17 +0800 Subject: [PATCH 6/6] Minor --- doc/wiki/Installation-related/Installation:-Option-List.md | 2 +- src/configure.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/wiki/Installation-related/Installation:-Option-List.md b/doc/wiki/Installation-related/Installation:-Option-List.md index e137d5e793..ddd7109f0f 100644 --- a/doc/wiki/Installation-related/Installation:-Option-List.md +++ b/doc/wiki/Installation-related/Installation:-Option-List.md @@ -115,7 +115,7 @@ disabled). See the "Restriction" of each option carefully. | `--mpi` | `true`, `false` | `false` | `true`: Enable load balancing using a space-filling curve (see [[MPI and OpenMP]]); `false`: Run GAMER in a serial mode, but OpenMP is still supported | May need to set `MPI_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `LOAD_BALANCE=HILBERT`, `SERIAL` | | `--overlap_mpi` | `true`, `false` | `false` | Overlap MPI communication with computation. | Not supported yet!!! Must enable `--mpi`. | `OVERLAP_MPI` | | `--gpu` | `true`, `false` | `false` | Enable GPU acceleration | Must specify `GPU_COMPUTE_CAPABILITY` and may need to set `CUDA_PATH` in [[configuration file \| Installation:-Machine-Configuration-File#1-Library-paths]] | `GPU` | -| `--gpu_regcount_flu` | > 0 | Depend | Set the maximum amount of registers that GPU functions can use. | Must be a positive integer. | | +| `--gpu_regcount_flu` | > 0 | Depend | Set the maximum amount of registers that GPU fluid solvers can use. | Must be a positive integer. | | ## Miscellaneous Options diff --git a/src/configure.py b/src/configure.py index 845c4b385c..6d91253cc9 100755 --- a/src/configure.py +++ b/src/configure.py @@ -839,7 +839,7 @@ def load_arguments( sys_setting : SystemSetting ): parser.add_argument( "--gpu_regcount_flu", type=int, metavar="INTEGER", default=None, depend={"gpu":True}, - help="Set the maximum amount of registers that GPU functions can use.\n" + help="Set the maximum amount of registers that GPU fluid solvers can use.\n" ) args, name_table, depends, constraints, prefix_table, suffix_table = parser.parse_args() @@ -855,7 +855,7 @@ def load_arguments( sys_setting : SystemSetting ): parser.print_autocomplete( args["autocomplete_info"] ) exit() - # 2. Conditional default arguments. + # 3. Conditional default arguments. args = set_conditional_defaults( args ) return args, name_table, depends, constraints, prefix_table, suffix_table