PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Hello World Fails

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Licenses and Installation
View previous topic :: View next topic  
Author Message
AU Phil



Joined: 04 Aug 2004
Posts: 20

PostPosted: Wed Mar 26, 2008 5:17 pm    Post subject: Hello World Fails Reply with quote

Hi - I can't seem to compile a simple "hello" program as shown in pgiug.pdf page 2:

[user1@mymachine clustertest]$ cat hello.f
print *, "hello"
end
[user1@mymachine clustertest]$ pgf95 hello.f
PGF90-S-0018-Illegal label field (hello.f: 1)
PGF90-S-0034-Syntax error at or near * (hello.f: 1)
PGF90-S-0018-Illegal label field (hello.f: 2)
PGF90-S-0022-Unexpected end of file - missing END statement (hello.f: 2)
0 inform, 0 warnings, 4 severes, 0 fatal for MAIN
[user1@mymachine clustertest]$

Any ideas? I'm stumped....with ":set invlist" in vi on the hello.f file, I get:

print *, "hello"$
end$
~
~
~

Is this correct? I was concerned about non-printing characters but this seems normal.

Thanks,
Phil
Back to top
View user's profile
AU Phil



Joined: 04 Aug 2004
Posts: 20

PostPosted: Wed Mar 26, 2008 5:34 pm    Post subject: Reply with quote

...ok, I'd like to register a complaint with documentation. If I do nothing but rename the file hello.f90, the compilation works:

[user1@mymachine clustertest]$ mv hello.f hello.f90
[user1@mymachine clustertest]$ cat hello.f90
print *, "hello"
end
[user1@mymachine clustertest]$ pgf95 hello.f90
[user1@mymachine clustertest]$ ls
a.out array.f hello.f90 mpi-hello.f
[user1@mymachine clustertest]$ ./a.out
hello
[user1@mymachine clustertest]$

The documentation (http://www.pgroup.com/doc/pgiug.pdf) on page 2, states clearly:

Step 2: Compile the program.
When you created your program, you called it hello.f. In this example, we compile it from a shell
command prompt using the default pgf95 driver option. Use the following syntax:
PGI$ pgf95 hello.f
PGI$
By default, the executable output is placed in the file a.out, or, on Windows platforms, in a filename based
on the name of the first source or object file on the command line. However, you can use the ľo option to
specify an output file name. To place the executable output in the file hello, use this command:
PGI$ pgf95 -o hello hello.f
PGI$
Step 3: Execute the program.
To execute the resulting hello program, simply type the filename at the command prompt and press the Return
or Enter key on your keyboard:
PGI$ hello
hello
PGI$

...no mention of the apparent requirement to name the file *.f90

Thanks,
Phil
Back to top
View user's profile
hongyon



Joined: 19 Jul 2004
Posts: 551

PostPosted: Thu Mar 27, 2008 8:25 am    Post subject: Reply with quote

Hi,

The error comes from your program itself. Please consult PGI Fortran Reference Manual on how to program in Fortran.

When you name your program .f, the compiler assume you use Traditional Fortran, meaning fixed format that is you must leave 6 columns before your actual code. If you put any letters the first 6 columns it must be meaningful such as labe. Fortran syntax are not the same as C where you can write at any column.

When you rename your file name ends with .f90 and use pgf90. Tt is obvious that you tell the compiler that it is F90 Fortran.

For F90 Fortran, it supports free format and for free format column are not significant.

Hongyon
Back to top
View user's profile
AU Phil



Joined: 04 Aug 2004
Posts: 20

PostPosted: Thu Mar 27, 2008 4:27 pm    Post subject: Reply with quote

It might be prudent to put a reminder in the documentation....for example, to remind system administrators who do NOT use the PGI compiler daily (or at all).

At my site, I merely install, update, etc. I do not use the compiler. I haven't used Fortran in a few decades. Now that you mention it, I do recall the 6 column requirement (doesn't that originate from reserved spacings on the old punch cards?)

Anyway, I (a system administrator) was reading the user manual to verify that the installation was successful and usable. The documentation makes no mention of the six column requirement near the listing of the program. It was this confusion that led me to post the issue.

Thanks,
Phil
Back to top
View user's profile
hongyon



Joined: 19 Jul 2004
Posts: 551

PostPosted: Fri Mar 28, 2008 8:26 am    Post subject: Reply with quote

Hi,

I will ask to add some kinds of install verification in Installation Notes.

Hongyon
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Licenses and Installation All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group