Changing CoArray Working Directories

Changing CoArray Working Directories

Is it possible to have different coarrays work on different working directories?

For example I have a variable WorkingDIR[*] that holds a different windows location on each image (say "c:\Image1\" and "c:\Image2\" and so forth). How do I set each coarrray to operate in their own specific working directory? The following SYSTEM command does not seem to work

IERR=SYSTEM('cd '//TRIM(WorkingDIR))

I am assuming because it opens a new cmd window and then imediately closes it while keeping the main program running in the original location.

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I just found the command CHANGEDIRQQ that seems to be working. Are there any standard FORTRAN commands that can do the same?


The Fortran language doesn't know about the concept of directories.

I tend to just prefix all filenames in OPEN statements and the like with your equivalent of WorkingDir.


An "Image" is run as a seperate process. Each process can have its own "current directory" and/or "current drive" and/or "PATH", ... "environment variables", ... resources.

Jim Dempsey

Thank so much, thats great to know. How would you set an environmental variable for different images?

My program is working great by having each image use CHANGEDIRQQ to operate in different folders.

There is no support for changing environment variables for specific images. I would say it is a bad idea to do this and would suggest putting the path you want as DEFAULTFILE in an OPEN statement. SYSTEM doesn't work because all that does is change the directory of the subprocess that SYSTEM creates - and then it goes away.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today