Path: news.mathworks.com!not-for-mail
From: Edric M Ellis <eellis@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: parfor: fopen Issues
Date: Thu, 25 Jun 2009 08:55:47 +0100
Organization: The Mathworks, Ltd.
Lines: 32
Message-ID: <ytwk530n3wc.fsf@uk-eellis-deb4-64.mathworks.co.uk>
References: <h1t155$jbg$1@fred.mathworks.com> <ytw1vp9omj1.fsf@uk-eellis-deb4-64.mathworks.co.uk> <h1teke$q6c$1@fred.mathworks.com> <ytwws71mzoq.fsf@uk-eellis-deb4-64.mathworks.co.uk> <h1utba$1us$1@fred.mathworks.com>
NNTP-Posting-Host: uk-eellis-deb4-64.mathworks.co.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: fred.mathworks.com 1245916547 29104 172.16.27.112 (25 Jun 2009 07:55:47 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 25 Jun 2009 07:55:47 +0000 (UTC)
X-Face: $Ahg}Iylezql"r1WV1Me5&)ng"a4v%D>==KMs-elCfj"o}$bh-VOt7lVXgLWsC?9mZ`mINT
 G6PDvca;nrgs$lfcr0l1ew'N]>nXKl}m|Zpg>,6*gLp~-N0N2*+b.iwv=u>@R$L4SEG&NYUU;lSR@u
 IHphdAy
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)
Cancel-Lock: sha1:BCT2/iyu+QuR63sWimGxR+tUaGo=
Xref: news.mathworks.com comp.soft-sys.matlab:550499


"Mr. CFD" <s2108860@student.rmit.edu.au> writes:

> Hi Edric, 
> Added the things you suggested as:
> script = [mesh_prefix, int2str(ii),'.bat'];
> [fidd, message] = fopen(script, 'wt');
> if fidd == -1
>     error( 'Couldn''t write to %s: %s', script, message );    
> end
> fprintf(fidd, '%s','Cscript.exe //NoLogo Airfoil_',num2str(ii),'.vbs | xfoil.exe');
>
> Had the following error appear about an hour into the simulation:
> =============================================
> ??? Error using ==> parallel_function at 587
> Error in ==> Main_Flight at 76
> Couldn't write to Airfoil_3.bat: Invalid argument
>
> Error in ==> Main_Optz_v2 at 203
>     matlabpool local 4
> ==============================================
> So does this mean that more then one processor was trying to access 'Airfoil_3.bat' in this case? 
> I really don't know how I can avoid this. The use of parfor is necessary to
> accelerate computation, but how do we avoid this file conflict?  Thanks

I don't think that looks like concurrent access. Are you writing the files onto
a network drive somewhere? If so, that could be one possible cause of that error
message. It might be worth trying to use a local disk for the .bat files. It
might just also be worth pausing and trying again on failure to fopen.

Cheers,

Edric.