LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-30-2008, 01:47 AM   #1
shreya.hiflying87
LQ Newbie
 
Registered: May 2008
Posts: 1

Rep: Reputation: 0
how to open files in a parallel code???


hi friends.........
i am using fedora 8 as my os.
my program is in fortran 90 and am using MPI ... while tryiing to open and write in a file....using 4 processors, some error creeps.which does not allow the files to be opened... can anyone plz tell where am i going wrong?
the program is........

implicit none
use mpi
integer t,Na,Nb,Nc,ios,i,ierr,myrank,p,m,mos,tt,Naa,Nbb,Ncc,j,Nam,uni,info,type,filetype,buff(9)
character(len=10) native
INTEGER(KIND=MPI_OFFSET_KIND) DISP
character(len=15) cpar, cpar1
character(len=25) datfilename
real Pb,k1,k2,r,Nbm,Ncm
CALL MPI_INIT(ierr)
CALL MPI_COMM_SIZE(MPI_COMM_WORLD,p,ierr)
CALL MPI_COMM_RANK(MPI_COMM_WORLD, myrank, ierr )
uni=(myrank+1)*10
write(cpar1,*) myrank
write(cpar,*) uni
datfilename = 'data.'//trim(adjustl(cpar1))
open(uni,file= datfilename,status='new',iostat=ios)
if (ios/=0) then
write(*,*) datfilename,'cannot be opened'
else
write(*,*) ' file ',datfilename,' successfully opened'
endif
CALL MPI_FINALIZE(ierr)

end program
 
Old 05-30-2008, 02:41 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
"if (ios/=0) then"

That doesn't look like FORTRAN to me - or did I fall asleep and miss something?

Did you run the program under a debugger and check whether the file was in fact opened and your test is the problem, or if the file really isn't opening.
 
Old 05-30-2008, 02:53 AM   #3
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by pinniped View Post
"if (ios/=0) then"

That doesn't look like FORTRAN to me
It is legal FORTRAN.

shreya.hiflying87, it would help if you gave specific error messages. Edit: also, you should put your code inside code tags, so as to preserve indentation.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Parallel Port Interrupt problem with C code? James Scrymgeour Linux - Kernel 15 11-17-2010 03:26 PM
LXer: Journalism in a world of open code and open self-education LXer Syndicated Linux News 0 01-30-2008 05:00 PM
LXer: Krugle offers code search engine for open source, with open source LXer Syndicated Linux News 0 02-27-2007 08:04 AM
How to write C Code to play MP3 files using Open sound System programming Under Linux shayad15 Programming 3 06-05-2006 12:46 PM
Open Firmware code for booting OS from SATA : sample code available somewhere ? drsparikh Linux - Hardware 0 03-12-2004 11:16 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration