Copies u11 and u12 into arrays without halos which then get written to output.
325 {
326 const char funcname[] = "par_swrite";
327#if (nproc>1)
328 MPI_Status status;
329
330 MPI_Datatype MPI_SEED_TYPE = (
sizeof(
seed)==
sizeof(int)) ? MPI_INT:MPI_LONG;
331#endif
334#ifdef _DEBUG
335 char dump_prefix[
FILELEN]=
"u11.";
336 char dump_buff[32];
337 sprintf(dump_buff,
"r%01d_c%06d",
rank,itraj);
338 strcat(dump_prefix,dump_buff);
339 FILE *gauge_dump=fopen(dump_prefix,"wb");
340
341
343 fclose(gauge_dump);
344#endif
345#ifdef __RANLUX__
347#endif
349
350#ifdef __RANLUX__
351 unsigned long *seed_array=(
unsigned long*)calloc(
nproc,
sizeof(
seed));
352#elif defined __USE_MKL__ && !defined USE_RAN2
353 int *seed_array=(
int *)calloc(
nproc,
sizeof(
seed));
354#else
355 long *seed_array=(
long*)calloc(
nproc,
sizeof(
seed));
356#endif
358#if(nproc>1)
359 for(
int iproc = 1; iproc<
nproc; iproc++)
360 if(MPI_Recv(&seed_array[iproc], 1, MPI_SEED_TYPE,iproc, 1, comm, &status)){
361 fprintf(stderr, "Error %i in %s: Failed to receive seed from process %i.\nExiting...\n\n",
364 }
365#endif
368
369 for(
int iproc=0;iproc<
nproc;iproc++)
370 for(
int idim=0;idim<
ndim;idim++){
371#if(nproc>1)
372 if(iproc){
373 if(MPI_Recv(u1buff,
kvol, MPI_C_DOUBLE_COMPLEX, iproc, 2*idim, comm, &status)){
374 fprintf(stderr, "Error %i in %s: Falied to receive u11 from process %i.\nExiting...\n\n",
377 }
378 if(MPI_Recv(u2buff,
kvol, MPI_C_DOUBLE_COMPLEX, iproc, 2*idim+1, comm, &status)){
379 fprintf(stderr, "Error %i in %s: Falied to receive u12 from process %i.\nExiting...\n\n",
382 }
383 }
384 else{
385#endif
386
387
388#ifdef USE_GPU
389 cudaMemcpy(u1buff,u11+idim*
kvol,
kvol*
sizeof(
Complex),cudaMemcpyDefault);
390 cudaMemcpy(u2buff,u12+idim*
kvol,
kvol*
sizeof(
Complex),cudaMemcpyDefault);
391#else
394#endif
395#ifdef _DEBUG
397 strcat(part_dump,dump_prefix);
398 sprintf(dump_buff,"_d%d",idim);
399 strcat(part_dump,dump_buff);
400 FILE *pdump=fopen(part_dump,"wb");
402 fclose(pdump);
403#endif
404#if(nproc>1)
405 }
406#endif
407 int i=0;
408 for(
int it=
pstart[3][iproc]; it<
pstop[3][iproc]; it++)
409 for(
int iz=
pstart[2][iproc]; iz<
pstop[2][iproc]; iz++)
410 for(
int iy=
pstart[1][iproc]; iy<
pstop[1][iproc]; iy++)
411 for(
int ix=
pstart[0][iproc]; ix<
pstop[0][iproc]; ix++){
412
414 u11Write[idim*
gvol+j] = u1buff[i];
415 u12Write[idim*
gvol+j] = u2buff[i];
416
417 i++;
418 }
420 fprintf(stderr, "Error %i in %s: Number of elements %i is not equal to\
421 kvol %i.\nExiting...\n\n",
NUMELEM, funcname, i,
kvol);
422#if(nproc>1)
424#else
426#endif
427 }
428 }
429 free(u1buff); free(u2buff);
430
431 char gauge_title[
FILELEN]=
"config.";
432 int buffer; char buff2[7];
433
434 buffer = (int)round(100*beta);
435 sprintf(buff2,"b%03d",buffer);
436 strcat(gauge_title,buff2);
437
438 buffer = (int)round(10000*akappa);
439 sprintf(buff2,"k%04d",buffer);
440 strcat(gauge_title,buff2);
441
442 buffer = (int)round(1000*fmu);
443 sprintf(buff2,"mu%04d",buffer);
444 strcat(gauge_title,buff2);
445
446 buffer = (int)round(1000*
creal(ajq));
447 sprintf(buff2,"j%03d",buffer);
448 strcat(gauge_title,buff2);
449
450 if(c_sw!=0){
451 buffer = (int)round(100*c_sw);
452 sprintf(buff2,"c%02d",buffer);
453 strcat(gauge_title,buff2);
454 }
455
456 sprintf(buff2,
"s%02d",
nx);
457 strcat(gauge_title,buff2);
458
459 sprintf(buff2,
"t%02d",
nt);
460 strcat(gauge_title,buff2);
461
463 strcpy(gauge_file,gauge_title);
464 char c[8];
465 sprintf(c,".%06d", itraj);
466 strcat(gauge_file, c);
467 printf("Gauge file name is %s\n", gauge_file);
468 printf(
"Writing the gauge file on processor %i.\n",
rank);
469 FILE *con;
470 char *fileop = "wb";
471 if(!(con=fopen(gauge_file, fileop))){
472 fprintf(stderr, "Error %i in %s: Failed to open %s for %s.\
473 \nExiting...\n\n",
OPENERROR, funcname, gauge_file, fileop);
474#if(nproc>1)
476#else
478#endif
479 }
480
481
482#if(nproc==1)
484#endif
485 fwrite(&
size,
sizeof(
int),1,con);
488
489
490 fwrite(seed_array,
nproc*
sizeof(
seed), 1, con);
491 fclose(con);
492 free(u11Write); free(u12Write);
493 free(seed_array);
494 }
495#if(nproc>1)
496 else{
498 fprintf(stderr, "Error %i in %s: Falied to send u11 from process %i.\nExiting...\n\n",
501 }
502 for(
int idim = 0; idim<
ndim; idim++){
503#ifdef USE_GPU
504 cudaMemcpy(u1buff,u11+idim*
kvol,
kvol*
sizeof(
Complex),cudaMemcpyDefault);
505 cudaMemcpy(u2buff,u12+idim*
kvol,
kvol*
sizeof(
Complex),cudaMemcpyDefault);
506#else
509#endif
510#ifdef _DEBUG
512 strcat(part_dump,dump_prefix);
513 sprintf(dump_buff,"_d%d",idim);
514 strcat(part_dump,dump_buff);
515 FILE *pdump=fopen(part_dump,"wb");
517 fclose(pdump);
518#endif
519 int i=0;
520 if(MPI_Send(u1buff,
kvol, MPI_C_DOUBLE_COMPLEX,
masterproc, 2*idim, comm)){
521 fprintf(stderr, "Error %i in %s: Falied to send u11 from process %i.\nExiting...\n\n",
524 }
525 if(MPI_Send(u2buff,
kvol, MPI_C_DOUBLE_COMPLEX,
masterproc, 2*idim+1, comm)){
526 fprintf(stderr, "Error %i in %s: Falied to send u12 from process %i.\nExiting...\n\n",
529 }
530 }
531 free(u1buff); free(u2buff);
532 }
533#endif
534 return 0;
535}
gsl_rng * ranlux_instd
RANLUX instance.