Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
It can, when the next version of the compiler decides it wants that symbol for its own purposes.Does it lead to trouble
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
I used the mypowf function, but my program became slower.
Any explenations?
I did not use "-ffast-math", as I did not know how. I am not a progammer, just an by exident scientist (not even that in my real live)
Davoud
It is likely to run slower if you don't use -ffast-math. When you compile your code with gcc, you give it options, one of those would be -ffast-math - that will take some short cuts, but it's only really relevant when working in corner-cases - such as dealing with infinity as an input or result. For the use you have, -ffast-math should give the exact same result.
I had already figured you weren't a proficient programmer - the code is not that good [just like you would probably spot something similar if I started discussing economics, trading and such].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
:-)
I tried to find it out myself, but how do I put compiler -ffast-math flags with gcc / code::Blocks?
I implemented the memcp, and its faster now!
Many thanks for the help and effort put.
Davoud
Under most non-real-time schedulers, there is no way to force a process to be scheduled exclusively so that it uses 100% of the CPU. However you can adjust its priority to make it more "attractive" to the scheduler, which will cause it to be scheduled more often. Of course the simplest way to give it as many cycles as possible is to make sure that nothing else is running on the machine.
At least, that's how I interpreted your question. The others seem to have interpreted it in terms of optimization. Thought I'd give an answer orthogonal to those.
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
...and to do that, use the command "nice" ("man nice" for details)....you can adjust its priority to make it more "attractive" to the scheduler, which will cause it to be scheduled more often.
And it's only of use if there actually is a less important application stealing CPU time. It won't make your program run faster.
In other words, if your total CPU usage isn't at 100%, nice isn't going to help, since there is CPU power available; the program just doesn't use it.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
No one said the program would run faster, it was only said it would be less interrupted (scheduled more often & longer) which was one of the OP requests.It won't make your program run faster.
Any reference about that? because as far as I know it does modify the scheduling policy of the process, the only 'unknown' parameter being when the new policy is applied (depending on the process current state).if your total CPU usage isn't at 100%, nice isn't going to help, since there is CPU power available;
The program has no choice, this is managed by the O/S.the program just doesn't use it.
The system will always attempt to use the CPU to 100% - only if there is no runnable task will it be lower than that. nice does not change what happens to a process that is sleeping because it's waiting for data from the disk, for example.
In this case, the application will use as much CPU-time as it can (it is doing some disk IO at the start and end, but it's marginal in the overall runtime). Unless there are other tasks running on the same machine, there will be little or no benefit from using nice.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Hi,
I investigated the pow thing further. It appears that even using -ffast-math it is slower. I suppose the reason is that I use x<1 e.G. mypow(15,0.25) as exponents.
The other things work well. Thank you.
Davoud