#ifdef HAVE_OPENMP #pragma omp parallel default(shared) #endif { #ifdef HAVE_OPENMP #pragma omp for #endif for(size_t it=0;it<n_threads;it++) { // Copy from the initial points array into current point size_t ip_size=initial_points.size(); for(size_t ipar=0;ipar<n_params;ipar++) { current[it][ipar]=initial_points[it % ip_size][ipar]; } if (it<ip_size) { // If we have a new unique initial point, then // perform a function evaluation using a function pointer func_ret[it]=func[it](n_params,current[it],w_current[it], data_arr[it]); } else { func_ret[it]=0; } } } // End of parallel region
// Get current rank and number of ranks int mpi_rank=0, mpi_size=1; MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); // If necessary, wait for the last rank to complete before // we start by sending a simple message. The message is // typically a pointer to the top of an array of some // specified size. This is a 1-length integer array. int tag=0, buffer=0; if (mpi_size>1 && mpi_rank>=1) { MPI_Recv(&buffer,1,MPI_INT,mpi_rank-1, tag,MPI_COMM_WORLD,MPI_STATUS_IGNORE); } // Read the file here ifstream fin("input.txt"); fin >> temp_string; fin.close(); // Send a message to the next rank to allow it to proceed if (mpi_size>1 && mpi_rank<mpi_size-1) { MPI_Send(&buffer,1,MPI_INT,mpi_rank+1, tag,MPI_COMM_WORLD); }
#!/bin/bash # Job name. Set this to something useful #PBS -N newmcmc_debug # Select machine (important for ACF) #PBS -l partition=beacon # Account specification (important for ACF) #PBS -A UT-ACF-051 # (This setting is different # for each different HPC system, but walltime is a very common # parameter, and is typically of the form HH:MM:SS). #PBS -l nodes=12,walltime=0:20:00 # The stdout and stderr files. These are useful in debugging the # code #PBS -e newmcmc_debug.err #PBS -o newmcmc_debug.out # Use an environment variable to change to the proper directory. # Useful on ACF. cd $PBS_O_WORKDIR # Load modules module load gsl # Final entry in PBS file is often the main command to run. # Note absence of & sign and use of 'mpirun'. This command # must often be reworked for each HPC system mpirun -n 2 -ppn=8 ./newmcmc -initial-point last_out -mcmc \ > newmcmc_debug.scr 2> newmcmc_debug.err
bamr -set max_time 900 -set prefix bamr_debug -run default.in \ -model twop -mcmc(but don't submit the job yet). Notice I use 900 seconds rather than the full 20 minutes?
Back to Andrew W. Steiner at the University of Tennessee.