PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Problems in Compiling Gromacs
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
gsbear



Joined: 06 Jul 2005
Posts: 4

PostPosted: Wed Jul 06, 2005 4:58 am    Post subject: Problems in Compiling Gromacs Reply with quote

When I trying to compile Gromacs-3.2.1, there are two errors occured:

pgcc -DHAVE_CONFIG_H -I. -I. -I../../src -I../../include
-DGMXLIBDIR=\"/public/bin/gromacs/share/top\" -I/usr/mpich-gm-pgi60/include
-I/opt/gm/binary/include -I/opt/gm/include -I/public/bin/fftw2.1.5/include
-I/usr/include/libxml2 -tp=k8-64 -I/usr/include/libxml2 -c tpxio.c -o tpxio.o
PGC-W-0095-Type cast required for this conversion (tpxio.c: 997)
PGC-S-0090-Scalar data type required for logical expression (tpxio.c: 1322)
PGC/x86-64 Linux/x86-64 6.0-2: compilation completed with severe errors
make[3]: *** [tpxio.lo] Error 1
make[3]: Leaving directory
`/public/home/develop/software/gromacs-3.2.1/src/gmxlib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/public/home/develop/software/gromacs-3.2.1/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/public/home/develop/software/gromacs-3.2.1/src'
make: *** [all-recursive] Error 1

I have checked the source code of the program,
In the file tpxio.c: line 997 is:
pr_block(debug,0,EBLOCKS(i),&(top->blocks[i]),TRUE);
The third parameter in the prototype of function pr_block is "const char*"

tpxio.c: line 1322 is: if (*box) copy_mat(state.box,box);

This program can be compiled with GNU C compiler. But throughout errors with pgcc. Is there any compiling options that can told the compiler not to do the check? Thanks.
Back to top
View user's profile
mleair



Joined: 19 Jul 2004
Posts: 67
Location: Portland Group

PostPosted: Thu Jul 07, 2005 5:04 pm    Post subject: Re: Problems in Compiling Gromacs Reply with quote

gsbear wrote:

I have checked the source code of the program,
In the file tpxio.c: line 997 is:
pr_block(debug,0,EBLOCKS(i),&(top->blocks[i]),TRUE);
The third parameter in the prototype of function pr_block is "const char*"

tpxio.c: line 1322 is: if (*box) copy_mat(state.box,box);

This program can be compiled with GNU C compiler. But throughout errors with pgcc. Is there any compiling options that can told the compiler not to do the check? Thanks.


Hi,

What is the type for formal argument #3 in the pr_block prototype? Is it char*? If so, when I tried a similar example with gcc I also received a warning. The program still compiled and ran with this warning, although it is probably a good idea to include a type case to eliminate this warning. As for the error, what is the type for box? I could not recreate an example that gave the same error that you received.

-Mark
Back to top
View user's profile
gsbear



Joined: 06 Jul 2005
Posts: 4

PostPosted: Thu Jul 07, 2005 11:37 pm    Post subject: Re: Problems in Compiling Gromacs Reply with quote

mleair wrote:
gsbear wrote:

I have checked the source code of the program,
In the file tpxio.c: line 997 is:
pr_block(debug,0,EBLOCKS(i),&(top->blocks[i]),TRUE);
The third parameter in the prototype of function pr_block is "const char*"

tpxio.c: line 1322 is: if (*box) copy_mat(state.box,box);

This program can be compiled with GNU C compiler. But throughout errors with pgcc. Is there any compiling options that can told the compiler not to do the check? Thanks.


Hi,

What is the type for formal argument #3 in the pr_block prototype? Is it char*? If so, when I tried a similar example with gcc I also received a warning. The program still compiled and ran with this warning, although it is probably a good idea to include a type case to eliminate this warning. As for the error, what is the type for box? I could not recreate an example that gave the same error that you received.

-Mark


The type for formal argument #3 in the pr_block prototype is "const char*"

"box" is a parameter of the function. The prototype is defined as a matrix. But I can't find the definition of matrix.
void read_tpx(char *fn,int *step,real *t,real *lambda,
t_inputrec *ir, matrix box,int *natoms,
rvec *x,rvec *v,rvec *f,t_topology *top)


By the way, Gromacs can be compiled smoothly with GCC,and running well.
Back to top
View user's profile
gsbear



Joined: 06 Jul 2005
Posts: 4

PostPosted: Fri Jul 08, 2005 1:35 am    Post subject: Reply with quote

The definition of matrix is in ../include/types/simple.h
It is a 2D array of real elements.

typedef real matrix[DIM][DIM];
Back to top
View user's profile
mleair



Joined: 19 Jul 2004
Posts: 67
Location: Portland Group

PostPosted: Fri Jul 08, 2005 11:43 am    Post subject: matrix box Reply with quote

Hi,

I was not able to reproduce the warning on the pr_box case. I could only produce it if I was passing a const char * actual argument to a char * formal argument. Nonetheless, it seems the important issue is the severe error you are getting on the "if (*box)" expression.

The box object is declared a matrix which, according to you, is typedef to a statically allocated two dimensional array. The way *box gets interpretted is implementation defined. For example, gcc and the Sun compiler do not complain. Perhaps they interpret box[DIM][DIM] as an array of pointers rather than an array of arrays. Our compiler interprets box[DIM][DIM] as an array of arrays. Therefore, *box is semantically giving you an array rather than a pointer to an array. Hence, the error. ICC seems to interpret this the same way too, as it generates a warning. Perhaps our compiler should just generate a warning too.

My guess is that once upon a time this code used dynamic memory allocation for the matrix and the expression "if (*box)" is checking to make sure the second dimension is not NULL. Otherwise, I can't figure out why this check is there in the first place -- it's always true with statically allocated arrays. Anyway, to work around this problem, you can add a cast (e.g., "if ( (matrix*) *box)") and the code should compile without issue on any C compiler.

-Mark
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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