- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I'm working with a f90 program compiled with ifort. In a routine the program call to system command to create a directory
...
if(ndim>1)then
filedir='output_'//TRIM(nchar)//'/'
filecmd='mkdir -p '//TRIM(filedir)
#ifdef NOSYSTEM
if(myid==1)call PXFMKDIR(TRIM(filedir),LEN(TRIM(filedir)),O'755',info)
#else
!HERE
if(myid==1)call system(filecmd)
#endif
#ifndef WITHOUTMPI
call MPI_BARRIER(MPI_COMM_WORLD,info)
#endif
...
The program compiles in a good way and run normally, but when it tries to open the created directory stop with
forrtl: No such file or directory
forrtl: severe (29): file not found, unit 11, file /usr/local/sge/users/test/jpprieto/ramses/output_00001/info_00001.txt
I'm sure that all conditions to call system are satisfied, but the program doesn't creat the directory. The program skip the line with "call system(filecmd)".
Some body can help me?
Thanks.
...
if(ndim>1)then
filedir='output_'//TRIM(nchar)//'/'
filecmd='mkdir -p '//TRIM(filedir)
#ifdef NOSYSTEM
if(myid==1)call PXFMKDIR(TRIM(filedir),LEN(TRIM(filedir)),O'755',info)
#else
!HERE
if(myid==1)call system(filecmd)
#endif
#ifndef WITHOUTMPI
call MPI_BARRIER(MPI_COMM_WORLD,info)
#endif
...
The program compiles in a good way and run normally, but when it tries to open the created directory stop with
forrtl: No such file or directory
forrtl: severe (29): file not found, unit 11, file /usr/local/sge/users/test/jpprieto/ramses/output_00001/info_00001.txt
I'm sure that all conditions to call system are satisfied, but the program doesn't creat the directory. The program skip the line with "call system(filecmd)".
Some body can help me?
Thanks.
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
JP,
use this option -save-temps
this will keep a copy of the FPP preprocessed file in your local directory. It will be named .i90 (if the source is .F90) or .i (if the source is .F )
See if your defines are correct.
But I see something else that may be a problem. if you:
USE IFPORT
then SYSTEM is a function and not a subroutine. You should have something like:
I = SYSTEM(filecmd)
use this option -save-temps
this will keep a copy of the FPP preprocessed file in your local directory. It will be named .i90 (if the source is .F90) or .i (if the source is .F )
See if your defines are correct.
But I see something else that may be a problem. if you:
USE IFPORT
then SYSTEM is a function and not a subroutine. You should have something like:
I = SYSTEM(filecmd)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Ronald Green (Intel)
JP,
use this option -save-temps
this will keep a copy of the FPP preprocessed file in your local directory. It will be named .i90 (if the source is .F90) or .i (if the source is .F )
See if your defines are correct.
But I see something else that may be a problem. if you:
USE IFPORT
then SYSTEM is a function and not a subroutine. You should have something like:
I = SYSTEM(filecmd)
use this option -save-temps
this will keep a copy of the FPP preprocessed file in your local directory. It will be named .i90 (if the source is .F90) or .i (if the source is .F )
See if your defines are correct.
But I see something else that may be a problem. if you:
USE IFPORT
then SYSTEM is a function and not a subroutine. You should have something like:
I = SYSTEM(filecmd)
About write I = SYSTEM(filecmd), this doesn't work.
I hope you can help me.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Super, I am glad it was working in a past context.
Now, let's try some coding:
Change:
if(myid==1)call system(filecmd)
to
if (myid==1) then
print "creating directory from parent dir"
i = system( 'pwd' )
print "mkdir command is", filecmd
i = system( filecmd )
print "stopping"
stop
end if
this might help you determine what is happening. the 'pwd' command will show where the code has it's current working directory, as your mkdir command is not using absolute paths but relative paths. Add to this knowledge the actual command you are issuing with filecmd.
ron
Now, let's try some coding:
Change:
if(myid==1)call system(filecmd)
to
if (myid==1) then
print "creating directory from parent dir"
i = system( 'pwd' )
print "mkdir command is", filecmd
i = system( filecmd )
print "stopping"
stop
end if
this might help you determine what is happening. the 'pwd' command will show where the code has it's current working directory, as your mkdir command is not using absolute paths but relative paths. Add to this knowledge the actual command you are issuing with filecmd.
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Ronald Green (Intel)
Super, I am glad it was working in a past context.
Now, let's try some coding:
Change:
if(myid==1)call system(filecmd)
to
if (myid==1) then
print "creating directory from parent dir"
i = system( 'pwd' )
print "mkdir command is", filecmd
i = system( filecmd )
print "stopping"
stop
end if
this might help you determine what is happening. the 'pwd' command will show where the code has it's current working directory, as your mkdir command is not using absolute paths but relative paths. Add to this knowledge the actual command you are issuing with filecmd.
ron
Now, let's try some coding:
Change:
if(myid==1)call system(filecmd)
to
if (myid==1) then
print "creating directory from parent dir"
i = system( 'pwd' )
print "mkdir command is", filecmd
i = system( filecmd )
print "stopping"
stop
end if
this might help you determine what is happening. the 'pwd' command will show where the code has it's current working directory, as your mkdir command is not using absolute paths but relative paths. Add to this knowledge the actual command you are issuing with filecmd.
ron
Hi, ron.
what is the variable type of "i"? I defined it as character(LEN=80), but the program didn't compile.
So I did the following modifications:
...
if(myid==1) then
write(*,*)'creating directory from parent dir'
call system( 'pwd' )
write(*,*)'mkdir command is', filecmd
call system( filecmd )
write(*,*)'stopping'
stop
end if
...
And I got the following output:
...
creating directory from parent dir
mkdir command is
mkdir -p output_00001/
stopping
...
So, the program doesn't execute the comand "pwd" and the directory output_00001/ hadn't created.
Well, really I don't know what's up.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
According to the system documentation, i should be INTEGER.
so change back to
integer :: i !..must go at top of procedure with other data declarations
i = system( 'pwd' )
and
i = system( filecmd )
You cannot 'call' system, this is incorrect and is not working.
ron
so change back to
integer :: i !..must go at top of procedure with other data declarations
i = system( 'pwd' )
and
i = system( filecmd )
You cannot 'call' system, this is incorrect and is not working.
ron

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page