Skip to content

Commit

Permalink
Updated OpenMP warning to use the PyClaw logging. This prints to the …
Browse files Browse the repository at this point in the history
…console and to the log file.
  • Loading branch information
weslowrie committed Jul 5, 2016
1 parent 55c4a3d commit 92158db
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pyclaw/classic/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,15 +610,17 @@ def __init__(self, riemann_solver=None, claw_package=None):
self.aux2 = None
self.aux3 = None
self.work = None
self.nthreads = None

super(ClawSolver3D,self).__init__(riemann_solver, claw_package)

import os
import warnings
if 'OMP_NUM_THREADS' not in os.environ:
warnings.warn("The environment variable 'OMP_NUM_THREADS' is unset. Set this variable to use OpenMP with more than 1 thread (i.e. export OMP_NUM_THREADS=4).")
self.logger.warn(""""The env variable 'OMP_NUM_THREADS' is unset.
Set this variable to use OpenMP with more
than 1 thread (i.e. export OMP_NUM_THREADS=4).""")
self.nthreads = int(os.environ.get('OMP_NUM_THREADS',1))

super(ClawSolver3D,self).__init__(riemann_solver, claw_package)

# ========== Setup routine =============================
def _allocate_workspace(self,solution):
r"""
Expand Down

0 comments on commit 92158db

Please sign in to comment.