Beispiel #1
0
static void
ggcm_mhd_ic_harris_asym_setup(struct ggcm_mhd_ic *ic)
{
  struct ggcm_mhd_ic_harris_asym *sub = ggcm_mhd_ic_harris_asym(ic);

  sub->Te = (sqr(sub->B1) - sqr(sub->B0)) / (2. * (sub->n0 - sub->n1) * (sub->Ti_over_Te + 1.));
  sub->nc = sqr(.5 * (sub->B1 + sub->B0)) / (2. * (sub->Ti_over_Te + 1.) * sub->Te);
  sub->Ti = sub->Ti_over_Te * sub->Te;

  MPI_Comm comm = ggcm_mhd_ic_comm(ic);
  mpi_printf(comm, "i.c. harris_asym: Te = %g\n", sub->Te);
  mpi_printf(comm, "i.c. harris_asym: Ti = %g\n", sub->Ti);
  mpi_printf(comm, "i.c. harris_asym: nc = %g\n", sub->nc);
}
Beispiel #2
0
static void
mrc_ts_step_step(struct mrc_ts *ts)
{
  assert(ts->stepf);
  ts->stepf(ts->stepf_ctx, ts, ts->x);

  // FIXME, this should go -> mrc_ts_step(), and be optional
  mpi_printf(mrc_ts_comm(ts), "step=%i time=%g dt=%e\n",
	     ts->n + 1, ts->time + ts->dt, ts->dt);
}
int main (void)
{
  int err;
  int rank = 1;
  int nproc = 2;

  err = mpi_printf(rank, nproc, "hello %s", "my friend");
  if (err != 0) return err;

  /* success! */
  return EXIT_SUCCESS;
}
Beispiel #4
0
static void
psc_bnd_particles_sub_setup(struct psc_bnd_particles *bnd)
{
  struct sub *sub = sub(bnd);

  const char *mprts_type = psc_mparticles_type(ppsc->particles);
  char s[10 + strlen(mprts_type)];
  if (0) {
  } else {
    strcpy(s, mprts_type);
  }

  MPI_Comm comm = psc_bnd_particles_comm(bnd);
  mpi_printf(comm, "INFO: using psc_bnd_particles '%s'\n", s);
  
  sub->fwd = psc_bnd_particles_create(comm);
  psc_bnd_particles_set_type(sub->fwd, s);
  psc_bnd_particles_set_psc(sub->fwd, bnd->psc);
  psc_bnd_particles_setup(sub->fwd);
  psc_bnd_particles_add_child(bnd, (struct mrc_obj *) sub->fwd);
}
Beispiel #5
0
static void
psc_harris_setup(struct psc *psc)
{
  struct psc_harris *harris = to_psc_harris(psc);

  double d_i = sqrt(harris->mi_over_me);
  psc->domain.corner[1] = -.5 * harris->LLy * d_i;
  psc->domain.length[1] = harris->LLy * d_i;
  psc->domain.length[2] = harris->LLz * d_i;
  harris->LLL = harris->lambda * d_i;
  harris->AA = harris->pert * harris->B0 * psc->domain.length[2] / (2. * M_PI);

  psc->kinds[KIND_ELECTRON].m = 1.;
  psc->kinds[KIND_ION     ].m = harris->mi_over_me;
  psc->kinds[KIND_ELECTRON].T = harris->Te;
  psc->kinds[KIND_ELECTRON].T = harris->Ti;

  if (harris->eta0 > 0.) {
    double nu = harris->eta0 * harris->B0 * 3.76 * pow(harris->Te, 1.5);
    psc_collision_set_type(psc->collision, "c");
    psc_collision_set_param_double(psc->collision, "nu", nu);
  }


  // initializes fields, particles, etc.
  psc_setup_super(psc);

  MPI_Comm comm = psc_comm(psc);
  mpi_printf(comm, "dt = %g, dy = %g dz = %g\n", psc->dt,
	     psc->patch[0].dx[1], psc->patch[0].dx[2]);
  mpi_printf(comm, "d_e = %g, d_i = %g\n", 1., d_i);
  mpi_printf(comm, "v_A = %g\n", harris->B0 / sqrt(harris->mi_over_me));
  mpi_printf(comm, "om_ci = %g om_ce = %g\n", harris->B0 / harris->mi_over_me,
	     harris->B0);
  mpi_printf(comm, "om_pi = %g om_pe = %g\n", 1. / sqrt(harris->mi_over_me), 1.);
  mpi_printf(comm, "lambda_De = %g\n", sqrt(harris->Te));
}
Beispiel #6
0
/* this routine parses and reads the parameterfile
 */
void read_parameter_file(char *fname)
{
  FILE *fd, *fdout;
  char buf[MAXLEN_PARAM_TAG + MAXLEN_PARAM_VALUE + 200], buf1[MAXLEN_PARAM_TAG + 200],
    buf2[MAXLEN_PARAM_VALUE + 200], buf3[MAXLEN_PARAM_TAG + MAXLEN_PARAM_VALUE + 400];
  int i, j, nt;
  int id[MAX_PARAMETERS];
  void *addr[MAX_PARAMETERS];
  char tag[MAX_PARAMETERS][MAXLEN_PARAM_TAG];
  int pnum, errorFlag = 0;

  if(sizeof(long long) != 8)
    {
      mpi_printf("\nType `long long' is not 64 bit on this platform. Stopping.\n\n");
      endrun();
    }

  if(sizeof(int) != 4)
    {
      mpi_printf("\nType `int' is not 32 bit on this platform. Stopping.\n\n");
      endrun();
    }

  if(sizeof(float) != 4)
    {
      mpi_printf("\nType `float' is not 32 bit on this platform. Stopping.\n\n");
      endrun();
    }

  if(sizeof(double) != 8)
    {
      mpi_printf("\nType `double' is not 64 bit on this platform. Stopping.\n\n");
      endrun();
    }

  if(ThisTask == 0)		/* read parameter file on process 0 */
    {
      nt = 0;

      strcpy(tag[nt], "DG_MaxLevel");
      addr[nt] = &DG_MaxLevel;
      id[nt++] = INT;

      strcpy(tag[nt], "FG_Nbin");
      addr[nt] = &FG_Nbin;
      id[nt++] = INT;

      strcpy(tag[nt], "EG_MaxLevel");
      addr[nt] = &EG_MaxLevel;
      id[nt++] = INT;

      strcpy(tag[nt], "TorbitFac");
      addr[nt] = &All.TorbitFac;
      id[nt++] = REAL;

      strcpy(tag[nt], "MaxVelInUnitsVesc");
      addr[nt] = &All.MaxVelInUnitsVesc;
      id[nt++] = REAL;

      strcpy(tag[nt], "TimeStepFactorOrbit");
      addr[nt] = &All.TimeStepFactorOrbit;
      id[nt++] = REAL;

      strcpy(tag[nt], "TimeStepFactorCellCross");
      addr[nt] = &All.TimeStepFactorCellCross;
      id[nt++] = REAL;

      strcpy(tag[nt], "TypeOfHaloVelocityStructure");
      addr[nt] = &All.TypeOfHaloVelocityStructure;
      id[nt++] = INT;

      strcpy(tag[nt], "TypeOfDiskVelocityStructure");
      addr[nt] = &All.TypeOfDiskVelocityStructure;
      id[nt++] = INT;

      strcpy(tag[nt], "TypeOfBulgeVelocityStructure");
      addr[nt] = &All.TypeOfBulgeVelocityStructure;
      id[nt++] = INT;

      strcpy(tag[nt], "HaloBetaParameter");
      addr[nt] = &All.HaloBetaParameter;
      id[nt++] = REAL;

      strcpy(tag[nt], "BulgeBetaParameter");
      addr[nt] = &All.BulgeBetaParameter;
      id[nt++] = REAL;

      strcpy(tag[nt], "HaloStreamingVelocityParameter");
      addr[nt] = &All.HaloStreamingVelocityParameter;
      id[nt++] = REAL;

      strcpy(tag[nt], "DiskStreamingVelocityParameter");
      addr[nt] = &All.DiskStreamingVelocityParameter;
      id[nt++] = REAL;

      strcpy(tag[nt], "BulgeStreamingVelocityParameter");
      addr[nt] = &All.BulgeStreamingVelocityParameter;
      id[nt++] = REAL;

      strcpy(tag[nt], "HaloDispersionRoverZratio");
      addr[nt] = &All.HaloDispersionRoverZratio;
      id[nt++] = REAL;

      strcpy(tag[nt], "DiskDispersionRoverZratio");
      addr[nt] = &All.DiskDispersionRoverZratio;
      id[nt++] = REAL;

      strcpy(tag[nt], "BulgeDispersionRoverZratio");
      addr[nt] = &All.BulgeDispersionRoverZratio;
      id[nt++] = REAL;

      strcpy(tag[nt], "MinParticlesPerBinForDensityMeasurement");
      addr[nt] = &All.MinParticlesPerBinForDensityMeasurement;
      id[nt++] = INT;

      strcpy(tag[nt], "MinParticlesPerBinForDispersionMeasurement");
      addr[nt] = &All.MinParticlesPerBinForDispersionMeasurement;
      id[nt++] = INT;

      strcpy(tag[nt], "OutermostBinEnclosedMassFraction");
      addr[nt] = &All.OutermostBinEnclosedMassFraction;
      id[nt++] = REAL;

      strcpy(tag[nt], "InnermostBinEnclosedMassFraction");
      addr[nt] = &All.InnermostBinEnclosedMassFraction;
      id[nt++] = REAL;

      strcpy(tag[nt], "CC");
      addr[nt] = &All.Halo_C;
      id[nt++] = REAL;

      strcpy(tag[nt], "Ahalo");
      addr[nt] = &All.Halo_A;
      id[nt++] = REAL;

      strcpy(tag[nt], "Vvir");
      addr[nt] = &All.Vvir;
      id[nt++] = REAL;

      strcpy(tag[nt], "LAMBDA");
      addr[nt] = &All.Lambda;
      id[nt++] = REAL;

      strcpy(tag[nt], "MD");
      addr[nt] = &All.MD;
      id[nt++] = REAL;

      strcpy(tag[nt], "MBH");
      addr[nt] = &All.MBH;
      id[nt++] = REAL;

      strcpy(tag[nt], "MB");
      addr[nt] = &All.MB;
      id[nt++] = REAL;

      strcpy(tag[nt], "JD");
      addr[nt] = &All.JD;
      id[nt++] = REAL;

      strcpy(tag[nt], "DiskHeight");
      addr[nt] = &All.DiskHeight;
      id[nt++] = REAL;

      strcpy(tag[nt], "BulgeSize");
      addr[nt] = &All.BulgeSize;
      id[nt++] = REAL;

      strcpy(tag[nt], "HaloStretch");
      addr[nt] = &All.HaloStretch;
      id[nt++] = REAL;

      strcpy(tag[nt], "BulgeStretch");
      addr[nt] = &All.BulgeStretch;
      id[nt++] = REAL;

      strcpy(tag[nt], "N_HALO");
      addr[nt] = &All.Halo_N;
      id[nt++] = INT;

      strcpy(tag[nt], "N_DISK");
      addr[nt] = &All.Disk_N;
      id[nt++] = INT;

      strcpy(tag[nt], "N_BULGE");
      addr[nt] = &All.Bulge_N;
      id[nt++] = INT;

      strcpy(tag[nt], "OutputDir");
      addr[nt] = All.OutputDir;
      id[nt++] = STRING;

      strcpy(tag[nt], "OutputFile");
      addr[nt] = All.OutputFile;
      id[nt++] = STRING;

      strcpy(tag[nt], "FractionToOptimizeIndependendly");
      addr[nt] = &All.FractionToOptimizeIndependendly;
      id[nt++] = REAL;

      strcpy(tag[nt], "IndepenentOptimizationsPerStep");
      addr[nt] = &All.IndepenentOptimizationsPerStep;
      id[nt++] = INT;

      strcpy(tag[nt], "StepsBetweenDump");
      addr[nt] = &All.StepsBetweenDump;
      id[nt++] = INT;

      strcpy(tag[nt], "MaximumNumberOfSteps");
      addr[nt] = &All.MaximumNumberOfSteps;
      id[nt++] = INT;

      strcpy(tag[nt], "SampleForceNhalo");
      addr[nt] = &All.SampleForceNhalo;
      id[nt++] = INT;

      strcpy(tag[nt], "SampleForceNdisk");
      addr[nt] = &All.SampleForceNdisk;
      id[nt++] = INT;

      strcpy(tag[nt], "SampleForceNbulge");
      addr[nt] = &All.SampleForceNbulge;
      id[nt++] = INT;

      strcpy(tag[nt], "SampleParticleCount");
      addr[nt] = &All.SampleParticleCount;
      id[nt++] = INT;

      strcpy(tag[nt], "SampleDensityFieldForTargetResponse");
      addr[nt] = &All.SampleDensityFieldForTargetResponse;
      id[nt++] = INT;

      strcpy(tag[nt], "MaxMemSize");
      addr[nt] = &All.MaxMemSize;
      id[nt++] = INT;

      strcpy(tag[nt], "UnitVelocity_in_cm_per_s");
      addr[nt] = &All.UnitVelocity_in_cm_per_s;
      id[nt++] = REAL;

      strcpy(tag[nt], "UnitLength_in_cm");
      addr[nt] = &All.UnitLength_in_cm;
      id[nt++] = REAL;

      strcpy(tag[nt], "UnitMass_in_g");
      addr[nt] = &All.UnitMass_in_g;
      id[nt++] = REAL;

      strcpy(tag[nt], "ErrTolTheta");
      addr[nt] = &All.ErrTolTheta;
      id[nt++] = REAL;

      strcpy(tag[nt], "ErrTolForceAcc");
      addr[nt] = &All.ErrTolForceAcc;
      id[nt++] = REAL;

      strcpy(tag[nt], "MultipleDomains");
      addr[nt] = &All.MultipleDomains;
      id[nt++] = INT;

      strcpy(tag[nt], "TopNodeFactor");
      addr[nt] = &All.TopNodeFactor;
      id[nt++] = REAL;

      strcpy(tag[nt], "SnapFormat");
      addr[nt] = &All.SnapFormat;
      id[nt++] = INT;

      strcpy(tag[nt], "NumFilesPerSnapshot");
      addr[nt] = &All.NumFilesPerSnapshot;
      id[nt++] = INT;

      strcpy(tag[nt], "NumFilesWrittenInParallel");
      addr[nt] = &All.NumFilesWrittenInParallel;
      id[nt++] = INT;

      strcpy(tag[nt], "TypeOfOpeningCriterion");
      addr[nt] = &All.TypeOfOpeningCriterion;
      id[nt++] = INT;

      strcpy(tag[nt], "Softening");
      addr[nt] = &All.Softening;
      id[nt++] = REAL;

      strcpy(tag[nt], "BufferSize");
      addr[nt] = &All.BufferSize;
      id[nt++] = INT;

      strcpy(tag[nt], "BufferSizeGravity");
      addr[nt] = &All.BufferSizeGravity;
      id[nt++] = INT;

      strcpy(tag[nt], "GravityConstantInternal");
      addr[nt] = &All.GravityConstantInternal;
      id[nt++] = REAL;

      if((fd = fopen(fname, "r")))
	{
	  sprintf(buf, "%s%s", fname, "-usedvalues");
	  if(!(fdout = fopen(buf, "w")))
	    {
	      printf("error opening file '%s' \n", buf);
	      errorFlag = 1;
	    }
	  else
	    {
	      printf("Obtaining parameters from file '%s':\n", fname);
	      while(!feof(fd))
		{
		  *buf = 0;
		  fgets(buf, MAXLEN_PARAM_TAG + MAXLEN_PARAM_VALUE + 200, fd);
		  if(sscanf(buf, "%s%s%s", buf1, buf2, buf3) < 2)
		    continue;

		  if(buf1[0] == '%')
		    continue;

		  for(i = 0, j = -1; i < nt; i++)
                    if(strcmp(buf1, tag[i]) == 0)
		      { 
                        j = i;
			tag[i][0] = 0;
			break;
		      }
                  if(j >= 0)
		    {
		      switch (id[j])
			{
			case REAL:
			  *((double *) addr[j]) = atof(buf2);
			  sprintf(buf3, "%%-%ds%%g\n", MAXLEN_PARAM_TAG);
			  fprintf(fdout, buf3, buf1, *((double *) addr[j]));
			  fprintf(stdout, buf3, buf1, *((double *) addr[j]));
			  break;
			case STRING:
			  strcpy((char *) addr[j], buf2);
			  sprintf(buf3, "%%-%ds%%s\n", MAXLEN_PARAM_TAG);
			  fprintf(fdout, buf3, buf1, buf2);
			  fprintf(stdout, buf3, buf1, buf2);
			  break;
			case INT:
			  *((int *) addr[j]) = atoi(buf2);
			  sprintf(buf3, "%%-%ds%%d\n", MAXLEN_PARAM_TAG);
			  fprintf(fdout, buf3, buf1, *((int *) addr[j]));
			  fprintf(stdout, buf3, buf1, *((int *) addr[j]));
			  break;
			}
		    }
		  else
		    {
		      fprintf(stdout, "Error in file %s:   Tag '%s' not allowed or multiply defined.\n",
			      fname, buf1);
		      errorFlag = 1;
		    }
		}
	      fclose(fd);
	      fclose(fdout);
	      printf("\n");

	      i = strlen(All.OutputDir);
	      if(i > 0)
		if(All.OutputDir[i - 1] != '/')
		  strcat(All.OutputDir, "/");

	      mkdir(All.OutputDir, 02755);

	      sprintf(buf1, "%s%s", fname, "-usedvalues");
	      sprintf(buf2, "%s%s", All.OutputDir, "parameters-usedvalues");
	      sprintf(buf3, "cp %s %s", buf1, buf2);

#ifndef NOCALLSOFSYSTEM
	      system(buf3);
#endif
	    }
	}
      else
	{
	  printf("Parameter file %s not found.\n", fname);
	  errorFlag = 1;
	}

      for(i = 0; i < nt; i++)
	{
	  if(*tag[i])
	    {
	      printf("Error. I miss a value for tag '%s' in parameter file '%s'.\n", tag[i], fname);
	      errorFlag = 1;
	    }
	}

    }

  MPI_Bcast(&errorFlag, 1, MPI_INT, 0, MPI_COMM_WORLD);

  if(errorFlag)
    {
      MPI_Finalize();
      exit(0);
    }

  /* now communicate the relevant parameters to the other processes */
  MPI_Bcast(&All, sizeof(struct global_data_all_processes), MPI_BYTE, 0, MPI_COMM_WORLD);

  MPI_Bcast(&DG_MaxLevel, sizeof(int), MPI_BYTE, 0, MPI_COMM_WORLD);
  MPI_Bcast(&FG_Nbin, sizeof(int), MPI_BYTE, 0, MPI_COMM_WORLD);
  MPI_Bcast(&EG_MaxLevel, sizeof(int), MPI_BYTE, 0, MPI_COMM_WORLD);


  for(pnum = 0; All.NumFilesWrittenInParallel > (1 << pnum); pnum++);

  if(All.NumFilesWrittenInParallel != (1 << pnum))
    {
      mpi_printf("NumFilesWrittenInParallel MUST be a power of 2\n");
      endrun();
    }

  if(All.NumFilesWrittenInParallel > NTask)
    {
      mpi_printf("NumFilesWrittenInParallel MUST be smaller than number of processors\n");
      endrun();
    }
}
Beispiel #7
0
int main(int argc, char** argv) {
  int rank, size;
  int N;
  char opt;
  int nt = -1;
  int max_threads = 16; // on jupiter

  bool id = false;


  algo_t algo = reduce_scatter;
  FILE *f = NULL;

  static const char optstring[] = "n:a:f:i:p:";
  static const struct option long_options[] = {
		{"n",			1, NULL, 'n'},
    {"file",		1, NULL, 'f'},
    {"i",			1, NULL, 'i'},
		{NULL,			0, NULL, 0}
  };


  MPI_Init(&argc,&argv);

  // get rank and size from communicator
  MPI_Comm_size(MPI_COMM_WORLD,&size);
  MPI_Comm_rank(MPI_COMM_WORLD,&rank);

	while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != EOF) {
    switch(opt) {
    case 'i':
      if (strcmp("procs", optarg) == 0) {
        id = true;
      }
      break;
    case 'p':
      nt = atoi(optarg);
      if (nt > max_threads) {
        printf("Using too much procs %d, use max %d", nt, max_threads);
        return EXIT_FAILURE;
      } else {
        printf("Using %d procs.", nt);
      }

    case 'n':
      N = atoi(optarg);
      break;    case 'f':
			f = fopen(optarg,"a");
			if (f == NULL) {
				mpi_printf(root, "Could not open log file '%s': %s\n", optarg, strerror(errno));
        MPI_Finalize();
				return  EXIT_FAILURE;
			}
			break;
    case 'a':
      if (strcmp("ref", optarg) == 0) {
        mpi_printf(root, "Using reference implementation \n");
        algo = ref;
      } else if ((strcmp("reduce_scatter", optarg) == 0)) {
        mpi_printf(root, "Using MPI_Allgather implementation \n");
        algo = reduce_scatter;
      }
      break;
    default:
      MPI_Finalize();
      return  EXIT_FAILURE;
    }
  }

  if(N == 0) {
		if ( rank == root ){
      printf("Usage: mpirun -nn nodecount p3-reduce_scatter.exe -n N\n");
      printf("N is the the matrix size. \n\n");
		}
		return 1;
  }


  /* ======================================================== */
  /* Initialisation matrix & vector */

  ATYPE *matrix = NULL;
  ATYPE *vector = NULL;


  if (rank == root) {
    debug("Setting up root data structures");
    matrix = init_matrix(N,1);
    vector = init_vector(N,1);
  }

  int colcnt =  N - (N/size ) * (size - 1 );
  int partition = N/size;

  ATYPE *local_matrix = NULL;
  local_matrix = (ATYPE*) malloc (sizeof(ATYPE) * N * colcnt);


  ATYPE *local_vector = NULL;
  local_vector = (ATYPE*) malloc (sizeof(ATYPE) * partition) ;


  ATYPE *reference = NULL;
  reference = init_vector(N,1);

  ATYPE *result = NULL;
  result = init_vector(N,1);

  double       inittime,totaltime;

  if( algo == ref) {
    if (rank == root) {
      inittime = MPI_Wtime();
      matrix_vector_mult_ref(matrix, vector, N, reference);
      totaltime = MPI_Wtime() - inittime;
    }
  } else if (algo == reduce_scatter) {

    if(rank == root){
      debug("Comptuting reference");
      matrix_vector_mult_ref(matrix, vector, N, reference);
    }

    MPI_Barrier(MPI_COMM_WORLD);

    /* ======================================================== */
    /* distributing matrix and vector */


    distribute_vector(vector, local_vector, rank, size, partition, N);
    distribute_matrix(matrix, local_matrix, rank, size, partition, N);


    debug("begin MPI_Reduce_scatter");
    MPI_Barrier(MPI_COMM_WORLD);
    inittime = MPI_Wtime();
    compute_reduce_scatter(local_matrix, local_vector, result, rank, size, N, partition);

    MPI_Barrier(MPI_COMM_WORLD);

    totaltime = MPI_Wtime() - inittime;
    double localtime = totaltime;

    MPI_Reduce(&localtime, &totaltime, 1, MPI_DOUBLE, MPI_MAX, root,  MPI_COMM_WORLD);

    debug("after MPI_Reduce_scatter");
  /* TODO: fix test so it uses vector idea  */
    /* debug("Testing result"); */
    /* if (test_vector_part(result, local_vector, (rank * partition) , partition)) { */
    /*   debug("testresult: OK"); */
    /* } else { */
    /*   debug("testresult: FAILURE"); */
    /*   debug("Result:"); */
    /*   printArray(recvbuff, N); */
    /*   debug("Reference:"); */
    /*   printArray(reference,N); */
    /* } */

    MPI_Barrier(MPI_COMM_WORLD);
  }

  if (rank == 0) {
    if (f != NULL) {
      if (id) {
        fprintf(f,"%d,%lf\n",nt, totaltime);
      } else {
        fprintf(f,"%d,%lf\n",N, totaltime);
      }
    }
    if (id) {
      printf("%d,%lf\n",nt , totaltime);
    } else {
      printf("%d,%lf\n",N , totaltime);
    }
  }

  debug("cleaning up");


  free(vector);

  free(matrix);

  MPI_Finalize();

  if ( f != NULL) {
    fclose(f);
  }
  return 0;
}
Beispiel #8
0
void print_result(const rs_sample *s_fit, fit_param *param)
{
    size_t i;
    int j;
    mat *fit,*fit_var;
    strbuf buf;
    
    i   = 0;
    fit = rs_sample_pt_cent_val(s_fit);
    
    fit_var = mat_create(fit_model_get_npar(&(param->fm),param),1);
    
    rs_sample_varp(fit_var,s_fit);
    mpi_printf("\n");
    mpi_printf("fit parameters :\n");
    if (IS_AN(param,AN_SCALE))
    {
        for(j=0;j<(int)param->nbeta;j++)
        {
            sprintf(buf,"a_%s",param->beta[j]);
            PRINT_SCALE(buf);
        }
        if (param->s_M_ud_deg > 0)
        {
            for (j=0;j<param->s_M_ud_deg;j++)
            {
                sprintf(buf,"s_p_ud_%d",j+1);
                PRINT_PAR(buf);
            }
        }
        if (param->s_M_s_deg > 0)
        {
            for (j=0;j<param->s_M_s_deg;j++)
            {
                sprintf(buf,"s_p_s_%d",j+1);
                PRINT_PAR(buf);
            }
        }
        if (param->s_with_a2ud)
        {
            PRINT_PAR("s_a2ud");
        }
        if (param->s_with_a2s)
        {
            PRINT_PAR("s_a2s");
        }
        if (param->s_umd_deg > 0)
        {
            for (j=0;j<param->s_umd_deg;j++)
            {
                sprintf(buf,"s_p_umd_%d",j+1);
                PRINT_PAR(buf);
            }
        }
        if (param->s_with_qed_fvol)
        {
            PRINT_PAR("s_p_fvol_L");
        }
    }
    if (IS_AN(param,AN_PHYPT))
    {
        if (param->with_const)
        {
            PRINT_PAR("const");
        }
        if (param->M_ud_deg > 0)
        {
            for (j=0;j<param->M_ud_deg;j++)
            {
                sprintf(buf,"p_ud_%d",j+1);
                PRINT_PAR(buf);
            }
        }
        if (param->M_s_deg > 0)
        {
            for (j=0;j<param->M_s_deg;j++)
            {
                sprintf(buf,"p_s_%d",j+1);
                PRINT_PAR(buf);
            }
        }
        if (param->with_a2 > 0)
        {
            PRINT_PAR("p_a2");
        }
        if (param->with_alpha_sa > 0)
        {
            PRINT_PAR("p_alpha_sa");
        }
        if (param->with_a2ud)
        {
            PRINT_PAR("p_a2ud");
        }
        if (param->with_a2s)
        {
            PRINT_PAR("p_a2s");
        }
        if (param->umd_deg)
        {
            PRINT_PAR("p_umd");
        }
        if (param->with_udumd)
        {
            for (j=0;j<param->with_udumd;j++)
            {
                sprintf(buf,"p_udumd_%d",j+1);
                PRINT_PAR(buf);
            }
        }
        if (param->with_sumd)
        {
            for (j=0;j<param->with_sumd;j++)
            {
                sprintf(buf,"p_sumd_%d",j+1);
                PRINT_PAR(buf);
            }
        }
        if (param->with_a2umd)
        {
            PRINT_PAR("p_a2umd");
        }
        if (param->with_alpha_saumd)
        {
            PRINT_PAR("p_alpha_saumd");
        }
        if (param->alpha_deg)
        {
            PRINT_PAR("p_alpha");
        }
        if (param->with_udalpha)
        {
            for (j=0;j<param->with_udalpha;j++)
            {
                sprintf(buf,"p_udalpha_%d",j+1);
                PRINT_PAR(buf);
            }
        }
        if (param->with_salpha)
        {
            for (j=0;j<param->with_salpha;j++)
            {
                sprintf(buf,"p_salpha_%d",j+1);
                PRINT_PAR(buf);
            }
        }
        if (param->with_aalpha)
        {
            PRINT_PAR("p_aalpha");
        }
        if (param->with_qed_fvol)
        {
            if (param->with_qed_fvol_monopmod)
            {
                if (param->with_qed_fvol == 2)
                {
                    PRINT_PAR("p_Linv_2");
                }
            }
            else
            {
                for (j=0;j<param->with_qed_fvol;j++)
                {
                    sprintf(buf,"p_Linv_%d",j+1);
                    PRINT_PAR(buf);
                }
            }
        }
        if (IS_AN(param,AN_PHYPT)&&!IS_AN(param,AN_SCALE)&&\
            (strbufcmp(param->with_ext_a,"") != 0))
        {
            for(j=0;j<(int)param->nbeta;j++)
            {
                sprintf(buf,"corr_a_%s",param->beta[j]);
                PRINT_SCALE(buf);
            }
        }
    }
    mpi_printf("\n");
    
    mat_destroy(fit_var);
}