diff --git a/CHANGELOG.md b/CHANGELOG.md index c2513b1..046ed4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.2.4] +### Added +* `++omp-num-threads` parameter to the `main()` entrypoint to limit the number of threads used by ISCE2 during + multiprocessing. + ### Fixed * For Solid Earth Tide computation, use azimuth timing to calculate solid earth tide in `science/grids/imagingGeometry` reference frame using ISCE2 rdr2geo. * Include topsapp_iono template. diff --git a/isce2_topsapp/__main__.py b/isce2_topsapp/__main__.py index a8e3c27..46dabf1 100644 --- a/isce2_topsapp/__main__.py +++ b/isce2_topsapp/__main__.py @@ -339,8 +339,19 @@ def main(): default="gunw_slc", help="Select the HyP3 entrypoint to use", ) + parser.add_argument( + "++omp-num-threads", + type=int, + help=("The number of OpenMP threads to use for parallel processing in ISCE2 routines; " + "when running locally, this topsapp will utilize all resources, which is not recommended; " + "suggest to set this option to 8 - 16 so other processes on server/workstation can running.") + ) + args, unknowns = parser.parse_known_args() + if args.omp_num_threads: + os.environ["OMP_NUM_THREADS"] = str(args.omp_num_threads) + sys.argv = [args.process, *unknowns] # FIXME: this gets better in python 3.10 # (process_entry_point,) = entry_points(group='console_scripts', name=args.process)