c - GCC performance -


I am doing parallel programming with MPI on the BOUULF cluster. We have written parallel algorithms for fake annealing. it works fine. We expect to execute 15 times faster than the serial code. But we did some performance of the serial C code on different architectures and operating systems, so we could have different data sets for performance measurement. We have used this random function in our code. We use GCC on both windows and Ubuntu Linux. We've learned that execution takes a lot of time in Linux, and we do not know why can anyone compile this code with GCC on Linux and Windows and try to explain it to me

#include & lt; Stdio.h & gt; # Include & lt; Stdlib.h & gt; # Include & lt; Time.h> Int main (int argc, char ** argv) {double random (); Int k, NUM_ITERATIONS = 10; Clock_t start_time = clock (); NUM_ITERATIONS = atoi (argv [1]); // uncertain random generator srand (time (faucet)); For (k = 0; k & gt; NUM_ITERATIONS; k ++) {double raa = Random (); } Clock_t end_time = clock (); Printf ("Algorithm Execution Time:% LF Seconds \ n", ((Double) (End-Time - Start_time) / CLOCKS_PER_SEC); Return 0; } // random number generated bettwen 0 and 1 double random () {srand (rand ()); Double A = Rand (); Return / / RAND_MAX; }

If I run it as 100 000 000, then I get a slow execution of 20 times compared to Windows. With the same architecture with dual boot wins Machine tested on Ubuntu Linux, we need help because it wants to show the random function with our data. According to the speed of execution of other random number generators available and both in the case of pseudo-randomness, there are both very well that test and standard libraries perform better than random tasks. I have also implemented my own RNG for a Graduate Class, but I will not use it in the production code. Go along with something that is cured by the community, which is a good resource for testing RNG you choose.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -