Skip to content

Commit 0e06cc9

Browse files
committed
main: Suppress TensorFlow GPU warnings when using --cpu-only flag
1 parent ca01ff7 commit 0e06cc9

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/geneml/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ def parse_args(argv=None):
268268
def main():
269269
args = parse_args()
270270
params = build_params_namedtuple(args)
271+
272+
if params.cpu_only:
273+
tf.config.set_visible_devices([], 'GPU')
274+
271275
logfile = ''.join([params.basepath, '.log'])
272276
setup_logger(logfile, debug = params.debug, verbose= params.verbose)
273277
write_setup_info(params)

0 commit comments

Comments
 (0)