AllInfo
Main: Info Blog Temp Mail


unix 2016-10-22 10-23-24

Тест OpenMP на разных линуксах

Тест проходил на разных дистрах... И выдает не стабильный результат

//  gcc -fopenmp test-omp.c ;./a.out;rm a.out
#include <stdio.h>
#include <omp.h>
#define N 1000
 
int main(int argc, char *argv[])
{
  double a[N], b[N], c[N], s;
  int i;
  omp_set_dynamic(0);      
  omp_set_num_threads(10); 

  for (i = 0; i < N; i++)
  {
      a[i] = i * 1.151;
      b[i] = i * 1.251;
  }
 
#pragma omp parallel for shared(a, b, c, s) private(i)
   for (i = 0; i < N; i++){
     c[i] = a[i] + b[i] ;
 s=s+c[i];
}
  printf ("%f\n", s);
  return 0;
}
prg@d77:~/Doc/bin$ lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 7.8 (wheezy)
Release:	7.8
Codename:	wheezy
prg@d77:~/Doc/bin$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
115122299.370000
prg@d77:~/Doc/bin$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
117596275.300000
Linux prg 3.18.2-2-ARCH #1 SMP PREEMPT Fri Jan 9 07:37:51 CET 2015 x86_64 GNU/Linux

[prg@prg bin]$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
1181654.292000
[prg@prg bin]$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
1172115.950000
prg@u14v:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.1 LTS
Release:	14.04
Codename:	trusty
prg@u14v:~$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
1199799.000000
prg@u14v:~$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
1199799.000000
prg@u14v:~$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
1199799.000000

Обновился Вск Янв 18 09:55:48 EET 2015 (apt-get update (upgrade))
prg@u14v:~$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
120087990.000000
prg@u14v:~$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
120087990.000000

[prg@test bin]$ lsb_release -a
LSB Version:	:base-4.0-ia32:base-4.0-noarch:core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID:	Scientific
Description:	Scientific Linux release 6.6 (Carbon)
Release:	6.6
Codename:	Carbon

[prg@test bin]$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
120087990.000000
[prg@test bin]$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
120087990.000000
[prg@test bin]$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
120087990.000000
[prg@test bin]$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
120087990.000000
[prg@test bin]$ gcc -fopenmp test-omp.c ;./a.out;rm a.out
120087990.000000

3.14.255.58 / 2024-12-22_20-37-18 UTC.