add unittest for python interface of accelerator config introspection
This commit is contained in:
@ -123,5 +123,40 @@ class PythonCapabilities(unittest.TestCase):
|
||||
self.lmp.command('run 10')
|
||||
self.assertEqual(self.lmp.extract_global('ntimestep'),20)
|
||||
|
||||
def test_accelerator_config(self):
|
||||
|
||||
settings = self.lmp.accelerator_config
|
||||
if self.cmake_cache['PKG_USER-OMP']:
|
||||
if self.cmake_cache['BUILD_OMP']:
|
||||
self.assertIn('openmp',settings['USER-OMP']['api'])
|
||||
else:
|
||||
self.assertIn('serial',settings['USER-OMP']['api'])
|
||||
self.assertIn('double',settings['USER-OMP']['precision'])
|
||||
|
||||
if self.cmake_cache['PKG_USER-INTEL']:
|
||||
if 'LMP_INTEL_OFFLOAD' in self.cmake_cache.keys():
|
||||
self.assertIn('phi',settings['USER-INTEL']['api'])
|
||||
elif self.cmake_cache['BUILD_OMP']:
|
||||
self.assertIn('openmp',settings['USER-INTEL']['api'])
|
||||
else:
|
||||
self.assertIn('serial',settings['USER-INTEL']['api'])
|
||||
self.assertIn('double',settings['USER-INTEL']['precision'])
|
||||
self.assertIn('mixed',settings['USER-INTEL']['precision'])
|
||||
self.assertIn('single',settings['USER-INTEL']['precision'])
|
||||
|
||||
if self.cmake_cache['PKG_GPU']:
|
||||
if self.cmake_cache['GPU_API'].lower() == 'opencl':
|
||||
self.assertIn('opencl',settings['GPU']['api'])
|
||||
if self.cmake_cache['GPU_API'].lower() == 'cuda':
|
||||
self.assertIn('cuda',settings['GPU']['api'])
|
||||
if self.cmake_cache['GPU_API'].lower() == 'hip':
|
||||
self.assertIn('hip',settings['GPU']['api'])
|
||||
if self.cmake_cache['GPU_PREC'].lower() == 'double':
|
||||
self.assertIn('double',settings['GPU']['precision'])
|
||||
if self.cmake_cache['GPU_PREC'].lower() == 'mixed':
|
||||
self.assertIn('mixed',settings['GPU']['precision'])
|
||||
if self.cmake_cache['GPU_PREC'].lower() == 'single':
|
||||
self.assertIn('single',settings['GPU']['precision'])
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user