PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

compiling in 64 bit a 32 bit program

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
THX 1138



Joined: 30 Jun 2011
Posts: 103

PostPosted: Tue Jul 10, 2012 12:07 pm    Post subject: compiling in 64 bit a 32 bit program Reply with quote

I have a program that runs very well in 32-bit mode. I wanted some additonal performance and hopefully some additonal parameter when I run the PGroup Profiler for Linux Workstation c/c++. So I just tried to port the code to 64 bit workstation. I changed nothng in the source code and just changed the path so it now points to the 64 bit pgcc instead of the 32 bit pgcc.

I made some small modifications to my Makefile and then typed make.

The compile line was the same, but it choked on three line in my thread.c file. The output is:

gcc -c -Wall -O0 -Mino=ccff -Mprof=func thread.c -o thread.o
thread.c: In function ‘CreateThread’:
thread.c:67: warning: format ‘%u’ expects type ‘unsigned int’, but argument 2 has type ‘size_t’
thread.c:67: warning: format ‘%x’ expects type ‘unsigned int’, but argument 3 has type ‘size_t’
thread.c:67: warning: format ‘%o’ expects type ‘unsigned int’, but argument 4 has type ‘size_t’

The CreateThread function is now shown:

/*Print out size of stack*/
if(pthread_attr_getstacksize(&thread_attr, &stack_size) !=0){
printf("%s - line %d; CreateThread: pthread_attr_getstacksize - getstacksize error!!\n"
, __FILE__, __LINE__);
return(-1);
};
printf("Pthread: Stack size = %u decimal, %x hexadecimal, %o octal\n",
stack_size,stack_size,stack_size );

return(0);
}

The line in question is the printf statement that extends on to another line. What is the problem (if there is one) and how do i fix it?

Please note that the program does compile and run. This is only a warning, but I am just wondering if something deeper is wrong.

Thanks in advance.

THX 1138
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6206
Location: The Portland Group Inc.

PostPosted: Tue Jul 10, 2012 3:17 pm    Post subject: Reply with quote

Hi THX 1138,

These are just warnings that GCC is giving you complaining that there is a mismatch in the expected data types that you are passing to printf. You can fix it by explicitly casting "stack_size" to an unsigned int, but most likely you can simply ignore these.

Note, that GCC it wont recognise the PGI -Mprof and -Minfo flags so you should remove them. Or if you use PGCC, remove the gcc flag -Wall and fix the typo where "-Mino" should be "-Minfo".

Hope this helps,
Mat
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
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