I have an ANSI C program that was compiled under Windows MSVC++ 6.0 (SP6) and
under Linux gnu, and ran under P3, P4 and AMD.
It runs fine on P3 and AMD under both Windows and Linux, but under P4 it has
problems. Under Windows 3GHz P4 runs twice slower than 800MHz P3... and under
Linux not only that it runs slower (while AMD is 40 times faster), but it also
produces wrong numerical results...
Any suggestion what can be the problem?
How to fix the P4 speed under MSVC++ (SP6)?
How to fix P4's speed and numerical result under Linux?
Here's some more details about the compilation:
GNU:
CFLAGS=-O6 -fexpensive-optimizations -ffast-math -fno-strength-reduce
-funroll-loops -fomit-frame-pointer -Wno-long-long -Wno-unused
Basically one of the most intensive loops (that we suspect in but aren't sure if
it causes the problem) looks like this:
static long loop_order;
void functionname ()
{
register float *iPtr, *itPtr, *iPtr1, *cPtr, acc;
register long j;
:
{
register float c1, c2;
j = loop_order;
while (j--)
{
acc = *itPtr-- * c1;
acc += *itPtr-- * c2;
acc += *itPtr++ * c3;
*cPtr++ += *iPtr1++ * acc;
}
}
:
}
We have tried to eliminate the use of the word "register" and redefined "j" as
volatile, no change.
Thanks,
-- VNG 1 1823
VNG wrote: I have an ANSI C program that was compiled under Windows MSVC++ 6.0 (SP6) and under Linux gnu, and ran under P3, P4 and AMD.
It runs fine on P3 and AMD under both Windows and Linux, but under P4 it has problems. Under Windows 3GHz P4 runs twice slower than 800MHz P3... and under Linux not only that it runs slower (while AMD is 40 times faster), but it also produces wrong numerical results...
Any suggestion what can be the problem?
How to fix the P4 speed under MSVC++ (SP6)? How to fix P4's speed and numerical result under Linux?
Here's some more details about the compilation: GNU: CFLAGS=-O6 -fexpensive-optimizations -ffast-math -fno-strength-reduce -funroll-loops -fomit-frame-pointer -Wno-long-long -Wno-unused
Basically one of the most intensive loops (that we suspect in but aren't sure if it causes the problem) looks like this:
static long loop_order;
void functionname () { register float *iPtr, *itPtr, *iPtr1, *cPtr, acc; register long j; : { register float c1, c2; j = loop_order; while (j--) { acc = *itPtr-- * c1; acc += *itPtr-- * c2; acc += *itPtr++ * c3; *cPtr++ += *iPtr1++ * acc; } } : }
We have tried to eliminate the use of the word "register" and redefined "j" as volatile, no change.
Why volatile? Also -ffast-math sounds like lower floating pointprecision
than normal.
The command line parameters I use for C90 programs:
-std=iso9899:199 409 -pedantic-errors -Wall -fexpensive-optimizations -O3
-ffloat-store -mcpu=pentiumpro
Try this, and do not use volatile and register unless needed.
Regards,
Ioannis Vranos http://www23.brinkster.com/noicys This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike Dee |
last post by:
A very very basic UTF-8 question that's driving me nuts:
If I have this in the beginning of my Python script in Linux:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
should I - or should I not - be able to use non-ASCII characters
in strings and in Tk GUI button labels and GUI window titles and in
raw_input data without Python returning...
|
by: Eric Myers |
last post by:
Hello folks:
(This message is also posted on the help forum at the pexpect
sourceforge page, but all indentation in the code got stripped away
when I submitted the post.)
For some time I've wanted to make use of the ANSI.py module in the
pexpect package to handle screen-based telnet sessions in Python, but I
could never break the ice...
|
by: VNG |
last post by:
I have an ANSI C program that was compiled under Windows MSVC++ 6.0 (SP6) and
under Linux gnu, and ran under P3, P4 and AMD.
It runs fine on P3 and AMD under both Windows and Linux, but under P4 it has
problems. Under Windows 3GHz P4 runs twice slower than 800MHz P3... and under
Linux not only that it runs slower (while AMD is 40 times...
|
by: Martín Marconcini |
last post by:
Hello there,
I'm writting (or trying to) a Console Application in C#. I has to be
console.
I remember back in the old days of Cobol (Unisys), Clipper and even Basic,
I used to use a program (its name i cannot recall now...) where I designed
the "screen" using this "program" and then saved it into an ASCII file.
(thus, using 'extended'...
|
by: Christopher Kurtis Koeber |
last post by:
Here is the story from Linux.org:
http://www.linux.org/news/2004/10/05/0009.html
I just want to know what everyone thinks on the issue. What will all of us
VB developers do, there isn't much of an equivalent language in Linux?
Any comments?
Christopher
| |
by: wwxw_0 |
last post by:
I am going to have some look at the ansi C implemention source of
linux, such as stdio, file operation and so on, Where can I get some
source code, I have downloaded linux source code but I cann't find
anything about it. Does anybody know this?
Thanks!
|
by: Daniele C. |
last post by:
As soon as my sourceforge.net project gets approved, I am going to
build a ncurses port to win32 bindable to sockets, e.g. allowing
VT100/ANSI terminals and the creation of simple terminal servers using
the ncurses API for the UI. I plan to initially support only a subset
of the ncurses lib, leaving the lib open to expansion/completion.
...
|
by: sunny |
last post by:
Hi All
What is C99 Standard is all about. is it portable, i mean i saw
-std=C99 option in GCC
but there is no such thing in VC++.?
which one is better ANSI C / C99?
can i know the major difference between C99 & ANSI C standards?
|
by: Leslie Kis-Adam |
last post by:
Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
Any help would be appreciated.
Laszlo Kis-Adam
<dfighter_AT-NOSPAM_freemail.hu
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |