class JobTestCase(unittest.TestCase): def setUp(self): self.job = Job() def testName(self): """Set job name""" correct = "test" self.job.setName(correct) self.assertEqual(self.job.name, correct, "Value= '{0}', Expected= '{1}'".format(self.job.name, correct)) def testParallel(self): """Set parallel job""" self.job.setIsParallel(True) assert self.job.isParallel, "Job is not parallel and should be."
def setUp(self): self.job = Job() self.batch = Batch() self.resource = Resource() rootDir = os.environ['BOLT_DIR'] self.batch.readConfig(rootDir + configDir + "/" + batchConfig) self.resource.readConfig(rootDir + configDir + "/" + resourceConfig)
class DistributionTestCase(unittest.TestCase): def setUp(self): self.job = Job() self.batch = Batch() self.resource = Resource() rootDir = os.environ['BOLT_DIR'] self.batch.readConfig(rootDir + configDir + "/" + batchConfig) self.resource.readConfig(rootDir + configDir + "/" + resourceConfig) def testParallelTaskDitributionPureMPI(self): """Pure MPI task distribution (fully populated).""" # Set the parallel distribution self.job.setTasks(1024) self.job.setTasksPerNode(self.resource.numCoresPerNode()) self.job.setThreads(1) self.job.setParallelJobLauncher(self.resource.distribJobLauncher) self.job.setParallelDistribution(self.resource, self.batch) correct = "aprun -n 1024 -N 32 -S 8 -d 1" self.assertEqual(self.job.runLine, correct, "Value= '{0}', Expected= '{1}'".format(self.job.runLine, correct)) def testParallelTaskDitributionHalfPopulate(self): """Pure MPI task distribution (half populated).""" # Set the parallel distribution self.job.setTasks(1024) self.job.setTasksPerNode(16) self.job.setThreads(1) self.job.setParallelJobLauncher(self.resource.distribJobLauncher) self.job.setParallelDistribution(self.resource, self.batch) correct = "aprun -n 1024 -N 16 -S 4 -d 2" self.assertEqual(self.job.runLine, correct, "Value= '{0}', Expected= '{1}'".format(self.job.runLine, correct)) def testParallelTaskDitributionTwoThreads(self): """Hybrid MPI/OpenMP task distribution (2 OpenMP threads).""" # Set the parallel distribution self.job.setTasks(1024) self.job.setTasksPerNode(16) self.job.setThreads(2) self.job.setParallelJobLauncher(self.resource.hybridJobLauncher) self.job.setParallelDistribution(self.resource, self.batch) correct = "export OMP_NUM_THREADS=2\naprun -n 1024 -N 16 -S 4 -d 2" self.assertEqual(self.job.runLine, correct, "Value= '{0}', Expected= '{1}'".format(self.job.runLine, correct)) def testParallelTaskDitributionThreeThreads(self): """Hybrid MPI/OpenMP task distribution (3 OpenMP threads).""" # Set the parallel distribution self.job.setTasks(1024) self.job.setTasksPerNode(10) self.job.setThreads(3) self.job.setParallelJobLauncher(self.resource.hybridJobLauncher) self.job.setParallelDistribution(self.resource, self.batch) correct = "export OMP_NUM_THREADS=3\naprun -n 1024 -N 10 -d 3" self.assertEqual(self.job.runLine, correct, "Value= '{0}', Expected= '{1}'".format(self.job.runLine, correct))
def setUp(self): self.job = Job()