Skip to content

Commit

Permalink
set KMP_INIT_AT_FORK only for darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
suberlak committed Mar 6, 2024
1 parent 85e890c commit ad722e8
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions python/lsst/ts/imsim/imsim_cmpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
__all__ = ["ImsimCmpt"]

import os
import sys
from typing import Any

import numpy as np
Expand Down Expand Up @@ -327,13 +328,20 @@ def run_imsim(self, config_file_path: str, imsim_log_file: str = "") -> None:
# this variable gets set when sklearn is imported, which happens inside
# of ts_wep before ever getting to this method, so we can't just unset
# it in the environment ahead of time.
with ModifiedEnvironment(KMP_INIT_AT_FORK=None):
if imsim_log_file == "":
runProgram(f"galsim {config_file_path}")
else:
runProgram(
f"galsim {config_file_path} -l {os.path.join(self.output_dir, imsim_log_file)} -v 2"
)
if imsim_log_file == "":
cmd = f"galsim {config_file_path}"
else:
cmd = f"galsim {config_file_path} -l {os.path.join(self.output_dir, imsim_log_file)} -v 2"
# Disabling the KMP_INIT_AT_FORK env variable only for OSX.
# This line checks whether the platform identifies itself as OSX.
# For all other environments (eg. linux) this is not needed;
# and indeed was found to cause issues for mag=12 and brighter
# source on USDF.
if sys.platform.startswith("darwin"):
with ModifiedEnvironment(KMP_INIT_AT_FORK=None):
runProgram(cmd)
else:
runProgram(cmd)

def write_yaml_and_run_imsim(
self,
Expand Down

0 comments on commit ad722e8

Please sign in to comment.