/* * gcc gsl-rng-parallel.c -lm -lgsl -lgslcblas -fopenmp */ #include #include #include #include #include void usage(int argc, char *argv[]){ printf("\n This program demonstrates how (not) to use the GSL Random Number Generator in OpenMP environment\n" "\n\n" " This is Free Software - You can use and distribute it under \n" " the terms of the GNU General Public License, version 3 or later\n\n" " (c) Al. Tro. (address@hidden)\n\n"); printf("Usage: %s [DIM. ENSAMBLE]\n" , argv[0]); } int main (int argc, char *argv[]){ if (argc != 2 ){ usage(argc,argv); exit(1); } int i; int DIM_ENSEMBLE = atoi(argv[1]); printf("n of threads is %d\n", 4); int n_threads = 4; n_threads = omp_get_max_threads(); printf("n of threads is %d\n", n_threads); double *d; gsl_rng **r ; d = malloc(DIM_ENSEMBLE*sizeof(double)); r = malloc(n_threads*sizeof(gsl_rng*)); for (i=0;i