diff --git a/doc/wiki/GPU.md b/doc/wiki/GPU.md index e80162cff8..75a0f73586 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_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 b832283fd6..ddd7109f0f 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_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 4a8a8e215e..6d91253cc9 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_flu", type=int, metavar="INTEGER", + default=None, + depend={"gpu":True}, + 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() args = vars( args ) @@ -849,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 @@ -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_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"]: + 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,12 @@ def validation( paths, depends, constraints, **kwargs ): LOGGER.error("<--rng=RNG_CPP11> is required for macOS.") success = False + # C. parallelization and flags + 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