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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-22-2004, 03:01 PM
|
#1
|
LQ Newbie
Registered: Mar 2004
Distribution: United Linux(they forced me to)
Posts: 16
Rep:
|
slower on linux
I need help. As those familiar with my whining will know I am porting a IA64 program to linux from windows. Everything seems to be going well. EXCEPT performace for one of our libraries(written in almost straight C++).
For test A linux under performs by 15% in test B linux underperforms by 40%!!!
The only difference is that on linux I am using setitimer, signal for SIGALRM, and gettimeofday.
On window I am using CreateTimerQueueTimer, QueryPerformanceCounter.
And yes I am using intels compiler on linux.
|
|
|
07-22-2004, 03:58 PM
|
#2
|
Member
Registered: Sep 2001
Location: Venezuela, Caracas
Distribution: RedHat 9.0
Posts: 196
Rep:
|
without more info or the code of the most time consuming parts (have you profiled yet?) is near to impossible to guess what to say to you that may be helpful
|
|
|
07-23-2004, 07:10 AM
|
#3
|
LQ Newbie
Registered: Mar 2004
Distribution: United Linux(they forced me to)
Posts: 16
Original Poster
Rep:
|
I can't profile for some reason. I compile gcc foo.cpp -lpthread. and when I run a.out I get a SIGILL for some reason. I am using gcc 3.2.2 on an ia64.
|
|
|
07-23-2004, 08:24 AM
|
#4
|
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246
Rep:
|
I think by profiling he means to compile with the -pg option and then to use the gprof command.
|
|
|
07-23-2004, 08:41 AM
|
#5
|
LQ Newbie
Registered: Mar 2004
Distribution: United Linux(they forced me to)
Posts: 16
Original Poster
Rep:
|
Yes I compile with -pg and the I get the SIGILL
gcc foo.cpp -pg -lpthread
foo.cpp
const long SIZE = 100000;
int main()
{
long arr[SIZE];
for( int i = 0; i < SIZE; i++ )
arr[i] = (i + 4) * (i - 2) + SIZE - i;
return 0;
}
Last edited by Sinner6; 07-23-2004 at 08:43 AM.
|
|
|
07-23-2004, 08:53 AM
|
#6
|
Member
Registered: May 2002
Posts: 964
Rep:
|
Do you get SIGKILL when running your compiled code? Not during the compile.
If you run ./a.out you create a mon.out file.
Then
gprof ./a.out
produces the profile information for you.
|
|
|
07-23-2004, 09:23 AM
|
#7
|
LQ Newbie
Registered: Mar 2004
Distribution: United Linux(they forced me to)
Posts: 16
Original Poster
Rep:
|
Yea I the SIGILL when I run a.out. It dies before it ever produces gmon.out
The compile looks fine, no warnings, no errors. but the I run a.out and bam SIGILL, Invalid Instruction
|
|
|
07-23-2004, 11:38 AM
|
#8
|
Member
Registered: May 2002
Posts: 964
Rep:
|
Okay. Something is not right. Do you have a thread sending SIGKILL?
Ordinarily applicaions don't send suicide signals unless programmed to do so.
Edit:
I just saw the 'invalid instruction'. You have a library module problem it sounds like. If you know how, try a fully static link. Then run it. Why? We want to make sure the problem is in the shared libraries only, otherwise you found a bug. If nothing else you get to see how much disk space you save by linking shared 
Last edited by jim mcnamara; 07-23-2004 at 11:42 AM.
|
|
|
07-23-2004, 12:21 PM
|
#9
|
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246
Rep:
|
Why do you name the file with a .cpp extension? It looks like it's just C code so should have a .c extension. If you're compiling C++ code use the g++ command. Also, I don't see any thread stuff in there so why are you linking in the pthread library?
Try just: gcc -Wall -pg foo.c -o foo
In fact, profiling won't even give you anything useful because you're not doing any function calls. It will just say it's spending all its time in main().
:  :
Last edited by itsme86; 07-23-2004 at 12:24 PM.
|
|
|
08-06-2004, 08:44 AM
|
#10
|
LQ Newbie
Registered: Mar 2004
Distribution: United Linux(they forced me to)
Posts: 16
Original Poster
Rep:
|
I upgraded from SuSe 8 to SuSe 9 and that seemed to fix it. Maybe it was a version of a library or gcc but it seems to work now.
|
|
|
All times are GMT -5. The time now is 12:58 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|