77
88from ..build import get_targets , build , REQUIRED_TARGETS , SIMULATION
99from ..printer import cons
10- from ..state import ARG , ARGS , CFG
10+ from ..state import ARG , ARGS , CFG , gpuConfigOptions
1111from ..common import MFCException , isspace , file_read , does_command_exist
1212from ..common import MFC_TEMPLATE_DIR , file_write , system , MFC_ROOT_DIR
1313from ..common import format_list_to_string , file_dump_yaml
@@ -99,6 +99,12 @@ def __generate_job_script(targets, case: input.MFCInputFile):
9999 'HIP_VISIBLE_DEVICES' : gpu_ids
100100 })
101101
102+ # Compute GPU mode booleans for templates
103+ gpu_mode = ARG ('gpu' )
104+ gpu_enabled = (gpu_mode != gpuConfigOptions .NONE .value )
105+ gpu_acc = (gpu_mode == gpuConfigOptions .ACC .value )
106+ gpu_mp = (gpu_mode == gpuConfigOptions .MP .value )
107+
102108 content = __get_template ().render (
103109 ** {** ARGS (), 'targets' : targets },
104110 ARG = ARG ,
@@ -107,7 +113,10 @@ def __generate_job_script(targets, case: input.MFCInputFile):
107113 MFC_ROOT_DIR = MFC_ROOT_DIR ,
108114 SIMULATION = SIMULATION ,
109115 qsystem = queues .get_system (),
110- profiler = shlex .join (__profiler_prepend ())
116+ profiler = shlex .join (__profiler_prepend ()),
117+ gpu_enabled = gpu_enabled ,
118+ gpu_acc = gpu_acc ,
119+ gpu_mp = gpu_mp
111120 )
112121
113122 file_write (__job_script_filepath (), content )
0 commit comments