Skip to content

Commit

Permalink
Fix thread number unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
GiudGiud committed Jun 20, 2020
1 parent 78b9ac1 commit 01e8df5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ simulation-state/*
*/simulation-state*
*/simulation-state*/*
pf_group_*_iter_*txt
k_negative_sources_iter*

*.data
*/*.data
Expand Down Expand Up @@ -179,8 +180,6 @@ sphinx/
*.xml
statepoint*
summary*
k_negative_sources_iter*
pf_group_*_iter_*.txt

# Test results error file
results_error.dat
Expand Down
10 changes: 7 additions & 3 deletions tests/unit_tests/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# keeps working.

class TestDefaultInit(unittest.TestCase):

# creates a new Options() every test
def setUp(self):
self._default_options = openmoc.options.Options()
Expand All @@ -38,8 +38,12 @@ def test_default_tolerance(self):
self.assertEqual(self._default_options._tolerance, .00001)

def test_default_num_omp_threads(self):
try:
default_num_threads = int(os.environ["OMP_NUM_THREADS"])
except KeyError:
default_num_threads = multiprocessing.cpu_count()
self.assertEqual(self._default_options._num_omp_threads,
multiprocessing.cpu_count())
default_num_threads)

def test_default_num_thread_blocks(self):
self.assertEqual(self._default_options._num_thread_blocks, 64)
Expand Down Expand Up @@ -88,4 +92,4 @@ def test_custom_num_gpu_threads(self):
suite = unittest.TestLoader().loadTestsFromTestCase(TestDefaultInit)
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestCustomInit))

unittest.TextTestRunner(verbosity=2).run(suite)
unittest.TextTestRunner(verbosity=2).run(suite)

0 comments on commit 01e8df5

Please sign in to comment.