Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/wiki/GPU.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions doc/wiki/Installation-related/Installation:-Option-List.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,11 @@ disabled). See the "Restriction" of each option carefully.

| &#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;<br>Option<br>&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192; | &#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;<br>Value<br>&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192; | &#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;<br>Default<br>&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192; | &#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;<br>Description<br>&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192; | &#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;<br>Restriction<br>&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192; | 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]] | <a name="--openmp"></a> `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]] | <a name="--mpi"></a> `LOAD_BALANCE=HILBERT`, <a name="SERIAL"></a> `SERIAL` |
| `--overlap_mpi` | `true`, `false` | `false` | Overlap MPI communication with computation. | Not supported yet!!! Must enable `--mpi`. | <a name="--overlap_mpi"></a> `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]] | <a name="--gpu"></a> `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]] | <a name="--openmp"></a> `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]] | <a name="--mpi"></a> `LOAD_BALANCE=HILBERT`, <a name="SERIAL"></a> `SERIAL` |
| `--overlap_mpi` | `true`, `false` | `false` | Overlap MPI communication with computation. | Not supported yet!!! Must enable `--mpi`. | <a name="--overlap_mpi"></a> `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]] | <a name="--gpu"></a> `GPU` |
| `--gpu_regcount_flu` | &gt; 0 | Depend | Set the maximum amount of registers that GPU fluid solvers can use. | Must be a positive integer. | <a name="--gpu_regcount_flu"></a> |


## Miscellaneous Options
Expand Down
37 changes: 26 additions & 11 deletions src/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,12 @@ def load_arguments( sys_setting : SystemSetting ):
help="Enable GPU. Must set <GPU_COMPUTE_CAPABILITY> 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 )

Expand All @@ -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

Expand Down Expand Up @@ -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 ):
Expand Down Expand Up @@ -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

Expand Down