Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Issues with SYSTEM and SYSTEMQQ

Alexander_I_1
Beginner
336 Views

Hi,

A bit off a backstory. We've been recently migrated to SSD in our company. After that fortran code that we have started running very slowly on my computer, my colleagues seem to be fine.

I've tracked the problem down in debugger to various IDUMMY = SYSTEM(command line stuff) calls. Basically whenever this place is reached I have 1-2 second pause before commad executes.

Solutions that have worked for me (i.e. they execute instantly):

deleting files:

either:

OPEN(UNIT=123, FILE='FileName', DISPOSE='DELETE')

CLOSE(UNIT=123)

or

IDUMMY = DELFILESQQ('FileName') !this seems to work just fine

 

Overwriting files:

OPEN(UNIT=123, FILE='FileName', STATUS='REPLACE')

 

Now my only remaining issue is one place where I have to copy a file.

I tried IDUMMY = SYSTEMQQ('copy [path]file1.txt [path]file2.txt') same result as with  IDUMMY = SYSTEMQQ('copy [path]file1.txt [path]file2.txt')

 

So I have two questions:

1) why could would this be happening?

2) any elegant way to copy a file in fortran without a using either SYSTEM or SYSTEMQQ? RENAMEFILEQQ executes instantly, but unfortunatelly also moves the file.

Any help would be aprreciated.

 

P.S. using Parallel Studio XE 2016 Update 3, version 16.0.0062.12

 

0 Kudos
3 Replies
JVanB
Valued Contributor II
335 Views
program P
   use ISO_FORTRAN_ENV
   implicit none
   integer(INT8), allocatable :: contents(:)
   integer iunit
   integer(INT64) size

   open(newunit=iunit,file='test.txt',status='old',access='stream')
   inquire(iunit,size=size)
   allocate(contents(size))
   read(iunit) contents
   close(iunit)
   open(newunit=iunit,file='copy.txt',status='replace',access='stream')
   write(iunit) contents
   close(iunit)
   deallocate(contents)
end program P

 

0 Kudos
Steve_Lionel
Honored Contributor III
336 Views

I would use the CopyFile Windows SDK routine. The Miscellaneous\CopyFolder sample, in the Parallel Studio XE samples bundle, demonstrates this. I attached a copy (!) here.

0 Kudos
Alexander_I_1
Beginner
336 Views

Thanks! This has helped.

0 Kudos
Reply