def testSingleGPU(self):
     self.maxDiff = None
     self.config.gpu_ids = [0]
     result = cg.createRunOptionsForSingleConfig(self.config, self.version,
                                                 self._default_options)
     expected = [
         {
             **self.expected_base, "ntmpi": 4,
             "ntomp": 1,
             "nb": "gpu",
             "gputasks": "0000"
         },
         {
             **self.expected_base, "ntmpi": 2,
             "ntomp": 2,
             "nb": "gpu",
             "gputasks": "00"
         },
         {
             **self.expected_base, "ntmpi": 1,
             "ntomp": 4,
             "nb": "gpu",
             "gputasks": "0"
         },
     ]
     self.assertCountEqual(result, expected)
 def testNoGpu(self):
     result = cg.createRunOptionsForSingleConfig(self.config, self.version,
                                                 self._default_options)
     expected = [{
         **self.expected_base, "ntmpi": 4,
         "ntomp": 1,
         "nb": "cpu"
     }]
     self.assertCountEqual(result, expected)
 def testSingleGPU(self):
     self.maxDiff = None
     self.config.gpu_ids = [0]
     result = cg.createRunOptionsForSingleConfig(self.config, self.version,
                                                 self._default_options)
     expected = [
         {
             **self.expected_base, "ntmpi": 4,
             "ntomp": 1,
             "nb": "gpu",
             "pme": "cpu",
             "gputasks": "0000"
         },
         {
             **self.expected_base, "ntmpi": 2,
             "ntomp": 2,
             "nb": "gpu",
             "pme": "cpu",
             "gputasks": "00"
         },
         {
             **self.expected_base, "ntmpi": 1,
             "ntomp": 4,
             "nb": "gpu",
             "pme": "cpu",
             "gputasks": "0"
         },
         # PME = gpu cases need npme=1
         {
             **self.expected_base, "ntmpi": 4,
             "ntomp": 1,
             "nb": "gpu",
             "pme": "gpu",
             "npme": 1,
             "gputasks": "0000"
         },
         {
             **self.expected_base, "ntmpi": 2,
             "ntomp": 2,
             "nb": "gpu",
             "pme": "gpu",
             "npme": 1,
             "gputasks": "00"
         },
         # Note the double gputask even though there's only one rank
         {
             **self.expected_base, "ntmpi": 1,
             "ntomp": 4,
             "nb": "gpu",
             "pme": "gpu",
             "gputasks": "00"
         },
     ]
     self.assertCountEqual(result, expected)
 def testMultiGPU(self):
     self.config.gpu_ids = [0, 1]
     result = cg.createRunOptionsForSingleConfig(self.config, self.version,
                                                 self._default_options)
     expected = [
         {
             **self.expected_base, "ntmpi": 4,
             "ntomp": 1,
             "nb": "gpu",
             "pme": "cpu",
             "gputasks": "0011"
         },
         {
             **self.expected_base, "ntmpi": 2,
             "ntomp": 2,
             "nb": "gpu",
             "pme": "cpu",
             "gputasks": "01"
         },
         # PME = gpu cases need npme=1
         {
             **self.expected_base, "ntmpi": 4,
             "ntomp": 1,
             "nb": "gpu",
             "pme": "gpu",
             "npme": 1,
             "gputasks": "0011"
         },
         {
             **self.expected_base, "ntmpi": 2,
             "ntomp": 2,
             "nb": "gpu",
             "pme": "gpu",
             "npme": 1,
             "gputasks": "01"
         },
     ]
     self.assertCountEqual(result, expected)
 def testMinimalSubset(self):
     self.maxDiff = None
     self.config.gpu_ids = [0]
     options = cg.GenerateOptions(max_sims_per_gpu=2,
                                  generate_exhaustive_options=False)
     result = cg.createRunOptionsForSingleConfig(self.config, self.version,
                                                 options)
     expected = [
         # PME = gpu cases need npme=1
         {
             **self.expected_base, "ntmpi": 4,
             "ntomp": 1,
             "nb": "gpu",
             "bonded": "gpu",
             "pme": "gpu",
             "npme": 1,
             "update": "gpu",
             "gputasks": "0000"
         },
         {
             **self.expected_base, "ntmpi": 2,
             "ntomp": 2,
             "nb": "gpu",
             "bonded": "gpu",
             "pme": "gpu",
             "npme": 1,
             "update": "gpu",
             "gputasks": "00"
         },
         # Note the double gputask even though there's only one rank
         {
             **self.expected_base, "ntmpi": 1,
             "ntomp": 4,
             "nb": "gpu",
             "bonded": "gpu",
             "pme": "gpu",
             "update": "gpu",
             "gputasks": "00"
         },
         # update = cpu cases
         {
             **self.expected_base, "ntmpi": 4,
             "ntomp": 1,
             "nb": "gpu",
             "pme": "cpu",
             "bonded": "cpu",
             "update": "cpu",
             "gputasks": "0000"
         },
         {
             **self.expected_base, "ntmpi": 2,
             "ntomp": 2,
             "nb": "gpu",
             "bonded": "cpu",
             "pme": "cpu",
             "update": "cpu",
             "gputasks": "00"
         },
         {
             **self.expected_base, "ntmpi": 1,
             "ntomp": 4,
             "nb": "gpu",
             "bonded": "cpu",
             "pme": "cpu",
             "update": "cpu",
             "gputasks": "0"
         },
     ]
     self.assertCountEqual(result, expected)