Commit bcd4006d authored by Niklas Bohn's avatar Niklas Bohn
Browse files

Disabled multiprocessing for both the optimization and the empirical line...


Disabled multiprocessing for both the optimization and the empirical line extrapolation in case SICOR is running on Windows or macOS.
Signed-off-by: Niklas Bohn's avatarnbohn <nbohn@gfz-potsdam.de>
parent cf87802e
......@@ -1127,7 +1127,9 @@ def __minimize__(fo, opt_func, unknowns=False, logger=None):
if platform.system() == "Windows" and processes > 1:
logger.warning('Multiprocessing is currently not available on Windows.')
if platform.system() == "Windows" or processes == 1:
if platform.system() == "Darwin" and processes > 1:
logger.warning('Multiprocessing is currently not available on macOS.')
if platform.system() == "Windows" or platform.system() == "Darwin" or processes == 1:
logger.info("Singleprocessing on 1 cpu")
else:
logger.info("Setting up multiprocessing...")
......@@ -1232,7 +1234,7 @@ def __minimize__(fo, opt_func, unknowns=False, logger=None):
# check if operating system is 'Windows'; in that case, multiprocessing is currently not working
# TODO: enable Windows compatibility for multiprocessing
if platform.system() == "Windows" or processes == 1:
if platform.system() == "Windows" or platform.system() == "Darwin" or processes == 1:
initializer(globals(), globs)
[mp_fun(ii) for ii in tqdm(rng, disable=fo.disable_progressbars)]
else:
......
......@@ -27,6 +27,7 @@
import numpy as np
from multiprocessing import Pool
from tqdm import tqdm
import platform
from sicor.Tools.EnMAP.multiprocessing import initializer
......@@ -144,7 +145,7 @@ def empirical_line_solution(X, rdn_subset, data_l2a_seg, rows, cols, bands, segs
global _globs
_globs = dict(tree=tree, locs=locations_subset, k=15, rdn=rdn_subset, data=data_l2a_seg, bands=bands)
if processes == 1:
if platform.system() == "Windows" or platform.system() == "Darwin" or processes == 1:
initializer(globals(), _globs)
results = []
for ii in tqdm(unique_labels, disable=disable_progressbars):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment