


{"id":343648,"date":"2024-01-08T13:57:43","date_gmt":"2024-01-08T13:57:43","guid":{"rendered":"\/forum\/forums\/topic\/error-when-running-a-topology-optimization-on-a-cluster-linux\/"},"modified":"2024-01-08T13:57:43","modified_gmt":"2024-01-08T13:57:43","slug":"error-when-running-a-topology-optimization-on-a-cluster-linux","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/error-when-running-a-topology-optimization-on-a-cluster-linux\/","title":{"rendered":"Error when running a topology optimization on a cluster (Linux)"},"content":{"rendered":"<p>We have installed Lumerical on a cluster, and I have used it to perform some more computationally expensive simulations. I use the following to run some scripts, and it works perfectly<\/p>\n<p style=\"padding-left: 40px\">time xvfb-run fdtd-solutions -nw -run somescript.lsf<\/p>\n<p>Additionally I am able to run python codes using the API with the following&nbsp;<\/p>\n<p style=\"padding-left: 40px\">time xvfb-run &#8220;\/home\/opt\/Lumerical\/2021-r1\/python-3.6.8rc1\/bin\/python&#8221; somepythonscript.py<\/p>\n<p>where test.py sets up an FDTD simulation, runs it, and saves the result. This also works fine!<\/p>\n<p><strong>However<\/strong>, recently I have tried to run some topology optimizations. I can run them perfectly on my laptop, but when I run the same file in the cluster, I get the following error:<\/p>\n<p style=\"padding-left: 40px\">srun: job 26320520 has been allocated resources<br \/>CONFIGURATION FILE {&#8216;root&#8217;: &#8216;\/home\/opt\/Lumerical\/2021-r1\/api\/python&#8217;, &#8216;lumapi&#8217;: &#8216;\/home\/opt\/Lumerical\/2021-r1\/api\/python&#8217;}<br \/>Initializing super optimization<br \/>Wavelength range of source object will be superseded by the global settings.<br \/>Wavelength range of source object will be superseded by the global settings.<br \/>Wavelength range of source object will be superseded by the global settings.<br \/>Wavelength range of source object will be superseded by the global settings.<br \/>Wavelength range of source object will be superseded by the global settings.<br \/>Making adjoint solves<br \/>Traceback (most recent call last):<br \/>&nbsp; File &#8220;topology_runsim.py&#8221;, line 82, in &lt;module&gt;<br \/>&nbsp; &nbsp; runSim(params, eps_bg, eps_wg, x_pos, y_pos, size_x*1e-9, size_y*1e-9, filter_R, working_dir=working_dir, beta=1)<br \/>&nbsp; File &#8220;topology_runsim.py&#8221;, line 61, in runSim<br \/>&nbsp; &nbsp; opt.run(working_dir = working_dir)<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumopt\/optimization.py&#8221;, line 351, in run<br \/>&nbsp; &nbsp; self.initialize(working_dir=working_dir)<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumopt\/optimization.py&#8221;, line 247, in initialize<br \/>&nbsp; &nbsp; plotting_function=plotting_function)<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumopt\/optimizers\/optimizer.py&#8221;, line 82, in initialize<br \/>&nbsp; &nbsp; self.reset_start_params(start_params, self.scale_initial_gradient_to)<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumopt\/optimizers\/optimizer.py&#8221;, line 90, in reset_start_params<br \/>&nbsp; &nbsp; self.auto_detect_scaling(scale_initial_gradient_to)<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumopt\/optimizers\/optimizer.py&#8221;, line 97, in auto_detect_scaling<br \/>&nbsp; &nbsp; gradients = self.callable_jac(params)<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumopt\/optimizers\/minimizer.py&#8221;, line 34, in callable_jac_local<br \/>&nbsp; &nbsp; fom_gradients = callable_jac(params_over_scaling_factor) \/ self.scaling_factor<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumopt\/optimization.py&#8221;, line 170, in callable_jac<br \/>&nbsp; &nbsp; nested_job_list = pool.map(func = make_adjoint_solves, iterable = enumerate(self.optimizations))<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/python-3.6.8rc1\/lib\/python3.6\/multiprocessing\/pool.py&#8221;, line 266, in map<br \/>&nbsp; &nbsp; return self._map_async(func, iterable, mapstar, chunksize).get()<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/python-3.6.8rc1\/lib\/python3.6\/multiprocessing\/pool.py&#8221;, line 644, in get<br \/>&nbsp; &nbsp; raise self._value<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/python-3.6.8rc1\/lib\/python3.6\/multiprocessing\/pool.py&#8221;, line 119, in worker<br \/>&nbsp; &nbsp; result = (True, func(*args, **kwds))<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/python-3.6.8rc1\/lib\/python3.6\/multiprocessing\/pool.py&#8221;, line 44, in mapstar<br \/>&nbsp; &nbsp; return list(map(*args))<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumopt\/optimization.py&#8221;, line 163, in make_adjoint_solves<br \/>&nbsp; &nbsp; forward_job_name = optimization.make_forward_sim(params, iter)<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumopt\/optimization.py&#8221;, line 589, in make_forward_sim<br \/>&nbsp; &nbsp; self.geometry.add_geo(self.sim, params = None, only_update = True)<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumopt\/geometries\/topology.py&#8221;, line 391, in add_geo<br \/>&nbsp; &nbsp; fdtd.eval(script)<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumapi.py&#8221;, line 1184, in eval<br \/>&nbsp; &nbsp; evalScript(self.handle, code)<br \/>&nbsp; File &#8220;\/home\/opt\/Lumerical\/2021-r1\/api\/python\/lumapi.py&#8221;, line 248, in evalScript<br \/>&nbsp; &nbsp; raise LumApiError(&#8220;Failed to evaluate code&#8221;)<br \/>lumapi.LumApiError: &#8216;Failed to evaluate code&#8217;<\/p>\n<p>I have not been able to figure out what is the problem. This is how I run the code:<\/p>\n<p style=\"padding-left: 40px\">time xvfb-run &#8220;\/home\/opt\/Lumerical\/2021-r1\/python-3.6.8rc1\/bin\/python&#8221; topology_runsim.py<\/p>\n<p>Any idea what could be causing the error?<\/p>\n","protected":false},"template":"","class_list":["post-343648","topic","type-topic","status-closed","hentry","topic-tag-fdtd","topic-tag-inverse-design-2","topic-tag-lumapi-2"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["249969","4274","707"],"_bbp_author_ip":["23.206.193.146"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["1722"],"_bbp_topic_status":["unanswered"],"_edit_lock":["1704722309:175686"],"_bbp_topic_id":["343648"],"_bbp_forum_id":["27833"],"_bbp_engagement":["707","4274","249969"],"_bbp_voice_count":["3"],"_bbp_reply_count":["16"],"_bbp_last_reply_id":["354493"],"_bbp_last_active_id":["354493"],"_bbp_last_active_time":["2024-02-29 09:55:25"]},"test":"samu-pekka-ojanentuni-fi"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/343648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/343648\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=343648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}