Skip to content

Commit cd35528

Browse files
author
Jan Ludwiczak
committed
Add option to control number of CPUs in deepcoil standalone. Limit number of cpus during testing
1 parent e558c2b commit cd35528

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

bin/deepcoil

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ parser.add_argument('-out_path',
1515
help='Output directory',
1616
default='.',
1717
metavar='DIR')
18+
parser.add_argument('-n_cpu',
19+
help='Number of CPUs to use in the prediction',
20+
default=-1,
21+
type=int,
22+
metavar='NCPU')
1823
parser.add_argument('--gpu',
19-
help='Use GPU',
24+
help='Use GPU. This option overrides -n_cpu option',
2025
action='store_true')
2126
parser.add_argument('--plot',
22-
help='Plot predictions. Images will be stored in the path defined by -out_path',
27+
help='Plot predictions. Images will be stored in the path defined by the -out_path',
2328
action='store_true')
2429
args = parser.parse_args()
2530

@@ -44,7 +49,7 @@ if not len(data) == len(raw_data):
4449
exit()
4550

4651
print("Loading DeepCoil model...")
47-
dc = DeepCoil(use_gpu=args.gpu)
52+
dc = DeepCoil(use_gpu=args.gpu, n_cpu=args.n_cpu)
4853

4954
print('Predicting...')
5055
preds = dc.predict(data)

tests/test_prediction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def test_seq_regression(self):
1212
f = h5py.File('tests/data/test_seq_ref.hdf5', 'r')
1313

1414
# Predict with DeepCoil
15-
dc = DeepCoil(use_gpu=False)
15+
dc = DeepCoil(use_gpu=False, n_cpu=4)
1616
results = dc.predict(seq_dict)
1717

1818
# Compare predictions with cached predictions

0 commit comments

Comments
 (0)