1010import tempfile
1111
1212import reframe as rfm
13+ import reframe .core .runtime as runtime
1314import reframe .utility .osext as osext
1415from reframe .core .exceptions import ConfigError
1516from reframe .core .logging import getlogger
16- from reframe .core .runtime import runtime
1717from reframe .core .schedulers import Job
1818from reframe .utility .cpuinfo import cpuinfo
1919
@@ -60,7 +60,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
6060def _subschema (fragment ):
6161 '''Create a configuration subschema.'''
6262
63- full_schema = runtime ().site_config .schema
63+ full_schema = runtime . runtime ().site_config .schema
6464 return {
6565 '$schema' : full_schema ['$schema' ],
6666 'defs' : full_schema ['defs' ],
@@ -125,7 +125,7 @@ def _emit_script(job, env):
125125 )
126126 topo_info = {}
127127 try :
128- prefix = runtime ().get_option ('general/0/remote_workdir' )
128+ prefix = runtime . runtime ().get_option ('general/0/remote_workdir' )
129129 with _copy_reframe (prefix ) as dirname :
130130 with osext .change_dir (dirname ):
131131 job = Job .create (part .scheduler ,
@@ -148,7 +148,7 @@ def _emit_script(job, env):
148148
149149
150150def detect_topology ():
151- rt = runtime ()
151+ rt = runtime . runtime ()
152152 detect_remote_systems = rt .get_option ('general/0/remote_detect' )
153153 topo_prefix = os .path .join (os .getenv ('HOME' ), '.reframe/topology' )
154154 for part in rt .system .partitions :
@@ -200,12 +200,18 @@ def detect_topology():
200200 if not found_procinfo :
201201 # No topology found, try to auto-detect it
202202 getlogger ().debug (f'> no topology file found; auto-detecting...' )
203+ temp_modules = rt .system .preload_environ .modules
203204 if _is_part_local (part ):
205+ temp_modules += part .local_env .modules
204206 # Unconditionally detect the system for fully local partitions
205- part .processor ._info = cpuinfo ()
207+ with runtime .temp_environment (modules = temp_modules ):
208+ part .processor ._info = cpuinfo ()
209+
206210 _save_info (topo_file , part .processor .info )
207211 elif detect_remote_systems :
208- part .processor ._info = _remote_detect (part )
212+ with runtime .temp_environment (modules = temp_modules ):
213+ part .processor ._info = _remote_detect (part )
214+
209215 if part .processor .info :
210216 _save_info (topo_file , part .processor .info )
211217
0 commit comments