Skip to content

Commit f10cd86

Browse files
committed
Disable time counting when verbose=0.
1 parent 35db4c1 commit f10cd86

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

deepxde/utils/internal.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ def timing(f):
1919
@wraps(f)
2020
def wrapper(*args, **kwargs):
2121
verbose = kwargs.get('verbose', 1)
22-
ts = timeit.default_timer()
23-
result = f(*args, **kwargs)
24-
te = timeit.default_timer()
2522
if verbose > 0 and config.rank == 0:
23+
ts = timeit.default_timer()
24+
result = f(*args, **kwargs)
25+
te = timeit.default_timer()
2626
print("%r took %f s\n" % (f.__name__, te - ts))
2727
sys.stdout.flush()
28+
else:
29+
result = f(*args, **kwargs)
2830
return result
2931

3032
return wrapper

0 commit comments

Comments
 (0)