Commit f4cf5529 authored by Wei Chengliang's avatar Wei Chengliang
Browse files

Optimized memory in add_objects

parent 2ac619d1
Pipeline #7386 passed with stage
in 0 seconds
No preview for this file type
......@@ -154,13 +154,12 @@ class Observation(object):
chip_output.Log_error(e)
chip_output.Log_error("Failed simulation on step: %s" % (step))
break
chip_output.Log_info("check running:1: pointing-%d chip-%d pid-%d memory-%6.2fGB" % (pointing.id,
chip.chipID, os.getpid(), (psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 / 1024)))
del chip.img
del chip.flat_img
del chip.prnu_img
del chip.shutter_img
chip_output.Log_info("check running:1: pointing-%d chip-%d pid-%d memory-%6.2fGB" % (pointing.id,
chip.chipID, os.getpid(), (psutil.Process(os.getpid()).memory_info().rss / 1024 / 1024 / 1024)))
def runExposure_MPI_PointingList(self, pointing_list, chips=None):
comm = MPI.COMM_WORLD
......@@ -239,5 +238,6 @@ class Observation(object):
"finished running chip#%d..." % (chip.chipID))
for handler in chip_output.logger.handlers[:]:
chip_output.logger.removeHandler(handler)
del chip_output
gc.collect()
process_counter += nchips_per_fp
......@@ -233,11 +233,12 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
self.chip_output.Log_error("obj id: %s" % (obj.param['id']))
self.chip_output.Log_error(" e1: %.5f\n e2: %.5f\n size: %f\n bfrac: %f\n detA: %f\n g1: %.5f\n g2: %.5f\n" % (
obj.param['e1'], obj.param['e2'], obj.param['size'], obj.param['bfrac'], obj.param['detA'], obj.param['g1'], obj.param['g2']))
# Unload SED:
obj.unload_SED()
del obj
# gc.collect()
cat.starDDL.freeGlobeData()
del cat.starDDL
if chip.survey_type == "spectroscopic" and not self.overall_config["run_option"]["out_cat_only"] and chip.slsPSFOptim:
# from observation_sim.instruments.chip import chip_utils as chip_utils
......
Supports Markdown
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