I've recently experienced an issue when using ZPL/Zrdplayback command for optimizing a non sequential system.
The local optimizer/orthogonal descent, worked fine, but the two global optimizers (Global search & Hammer) stopped at the start of the optimization process with the following error message 'Unable to save file...'.
I've found a design file in this forum showing the same behavior (please check the attached file). I suspect that the problem arises when several variations of the initial model are generated and attempt to create and/or read the rayfile from the ZPL macro.
Could you please comment and propose a fix that would ideally, preserve the call to zrdplayback?
Best answer by Olivier.FRANCOISView original
I think you're right about the problem. It looks like when the system is copied across the different threads, the error appears. While both the Hammer and Local optimizer are set up to be multi-threaded, it is often the case that the cost to produce copies of the system data across threads in the Local optimizer outruns the benefit of running any pieces of the computation in parallel. As such, it is likely that the Local optimization routine remained single threaded while you used it and was therefore able to avoid this error.
To continue using this ZPLM, you will need to change the settings of the Hammer optimization so that it is only using 1 core. That means that only 1 copy of the file is being created. I don't see another way to get around this error as text files are not able to be opened by multiple sources at one time.
If the macro is being called ina multi-threaded manner, use $TEMPFILENAME() to get a temporary file name inside the macro. That way, each copy gets its own file.
That's a great idea. I didn't think of that. In this case, the macro solve will probably need to be updated to delete the temp file at the end. Otherwise we could run into a memory allocation error if the Hammer optimization is run too long. Since the data from the temp file is already stored as variable 'X' in the provided sample, deleting the ZRD file shouldn't be a problem.
Hi Allie, Mark,
Thanks, that works like a charm!