[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: saving plot to file, Ghostscript collision error?
From: |
Mike Miller |
Subject: |
Re: saving plot to file, Ghostscript collision error? |
Date: |
Sat, 16 Jun 2012 09:42:44 -0400 |
On Fri, Jun 15, 2012 at 11:05 PM, Nicholas Jankowski
<address@hidden> wrote:
> On Fri, Jun 15, 2012 at 10:26 PM, Ben Abbott <address@hidden> wrote:
>>
>> On Jun 15, 2012, at 10:14 PM, Nicholas Jankowski wrote:
>>
>>> Using Octave3.6.2gcc4.6.2 on windows (mingw) running the same octave
>>> script on separate cores for some brute force 'parallel processing', I
>>> have the script generate and save a bunch of plots as it goes along.
>>> Done this a number of times, and this was the first I noticed the
>>> following error message popping up:
>>>
>>> -----
>>> GPL Ghostscript 9.05: Unrecoverable error, exit code 1
>>> The process cannot access the file because it is being used by another
>>> process.
>>> -----
>>>
>>> Octave continues with the loop, running followon iterations. Looking
>>> in the output folder, a couple of the plot files are missing. others
>>> are there but missing elements (usually the plot is there but the
>>> label I put on each graphic is missing).
>>>
>>> certain scripts run faster, so in the past the different processes
>>> usually hit this part of the script at different times. this time I
>>> restarted them all at this spot, and noticed all of these error
>>> messages.
>>>
>>> So, is ghostscript using some temporary files to generate plot images
>>> and I can't have separate Octave instances calling it?
>>>
>>> here's the sloppy code creating the two plots per iteration. I think
>>> the jpg one is the one that runs into problems
>>>
>>> fig1=plot(ZZ,normtemps,"*");
>>> hold on;
>>> plot(sortedtrue(:,1),sortedtrue(:,2),"linewidth",3,'k');
>>> axis('square');
>>> text(get(gca(),"xlim")(2)*.75,get(gca(),"ylim")(2)*.75,"stringtoprinthere");
>>> hold off;
>>> saveas(fig1,"filenamehere",".jpg"));
>>>
>>> fig3=plot(anasteptimes,xxana_l,"b",steptimes,xx,"xr"); axis("square");
>>> text(get(gca(),"xlim")(2)*.75,get(gca(),"ylim")(2)*.75,"stringtoprinthere");
>>> saveas(fig3,"filenamehere",".emf"))
>>
>>
>> Octave does use temporary files when printing, but their names have random
>> content, so there should be no conflict.
>>
>> Are the different instances of Octave trying to save a figure to the same
>> file name?
>>
>> Are you able to determine the name of the file that ghostscript cannot
>> access?
>>
>> Ben
>>
>>
>
> yes, if started at the same time the two files would probably have the
> same filename (different folder). maybe the random name hashes based
> on filename so there was a temp file collision? how much overhead
> would an ifexist() check add?
If you can reproduce this with debug logging, that will help us see
what the intermediate file names are and if there is a name collision.
Replace your saveas(...) commands with something like
print(fig1, [filename ".jpg"], "-djpg", ["-debug=" filename ".jpg.log"])
You'll get the full ghostscript commands printed to your terminal and
you'll also get a gnuplot trace saved in the .log files associated
with each image. What are the intermediate file names you see that
correspond to the missing images?
--
mike