@@ -2217,4 +2217,25 @@ def test_overrides(self, caplog):
22172217 expected = ("Kernel" , 0 , check , 0 )
22182218 self .parse_output (caplog , expected )
22192219
2220- # Test with OpenACC
2220+ def test_device (self , caplog ):
2221+ # Note: this uses switchconfig and runs on all backends to reflect expected
2222+ # usage: users are likely to run the estimate on the orchestration node which
2223+ # may not have the intended hardware, before using this output to determine which
2224+ # nodes to farm jobs out to.
2225+ grid = Grid (shape = (101 , 101 ))
2226+
2227+ f = Function (name = 'f' , grid = grid , space_order = 2 )
2228+
2229+ # Compiler is never invoked, so this should be fine
2230+ config = {'log_level' : 'DEBUG' , 'language' : 'openacc' ,
2231+ 'platform' : 'nvidiaX' }
2232+ with switchconfig (** config ), caplog .at_level (logging .DEBUG ):
2233+ op = Operator (Eq (f , 1 ))
2234+
2235+ op .estimate_memory (human_readable = False )
2236+
2237+ check = reduce (mul , f .shape_allocated )* np .dtype (f .dtype ).itemsize
2238+
2239+ # Matching memory allocated both on host and device for memmap
2240+ expected = ("Kernel" , 0 , check , check )
2241+ self .parse_output (caplog , expected )
0 commit comments