Commit 3dbf180a authored by Plaszczynski Stephane's avatar Plaszczynski Stephane
Browse files

add buchSize keyword to all MCMXC samplers - update scripts

parent ef5a8f88
......@@ -76,6 +76,7 @@ dim=$ndim
algo=ada
length=$NSAMPLES
proposal_cov=$cov
bunchSize=1000
t0=200
ts=10000
scale=0.001
......@@ -118,7 +119,7 @@ exit 1
fi
#qsub -P P_planck_prod -t 1-$NCHAINS -pe openmpi_$MCORE $MCORE -q pa_long -l sps=1 -R y -j y -o $PWD -e $PWD -N $zeroot zerun.sh
qsub -P P_planck_prod -t 1-$NCHAINS -pe multicores $MCORE -q mc_longlasting -l sps=1 -R y -j y -o $PWD -e $PWD -N $zeroot zerun.sh
#qsub -P P_planck_prod -t 1-$NCHAINS -pe multicores $MCORE -q mc_longlasting -l sps=1 -R y -j y -o $PWD -e $PWD -N $zeroot zerun.sh
cd -
#!/bin/env bash
NCHAINS=4
MCORE=16
MCORE=8
myexec=$CAMELROOT/$CMTCONFIG/mcmc
......@@ -63,6 +63,7 @@ fi
cat > mc_setup <<EOF
dim=$ndim
bunchSize=1000
algo=ada
length=$NSAMPLES
proposal_cov=$cov
......@@ -104,8 +105,8 @@ if [ $answer != 'o' ] ; then
echo "exiting"
exit 1
fi
qsub -P P_planck_prod -t 1-$NCHAINS -pe openmpi_$MCORE $MCORE -q pa_long -l sps=1 -V -R y -j y -o $PWD -e $PWD -N $zeroot zerun.sh
#qsub -P P_planck_prod -t 1-$NCHAINS -pe multicores $MCORE -q mc_long -l sps=1 -V -R y -j y -o $PWD -e $PWD -N $zeroot zerun.sh
#qsub -P P_planck_prod -t 1-$NCHAINS -pe openmpi_$MCORE $MCORE -q pa_long -l sps=1 -V -R y -j y -o $PWD -e $PWD -N $zeroot zerun.sh
qsub -P P_planck_prod -t 1-$NCHAINS -pe multicores $MCORE -q mc_long -l sps=1 -V -R y -j y -o $PWD -e $PWD -N $zeroot zerun.sh
#qsub -P P_planck_prod -t 1-$NCHAINS -l sps=1 -V -R y -j y -o $PWD -e $PWD -N $zeroot zerun.sh
......
......@@ -311,7 +311,7 @@ void MCMC_adaptive::fill_chain(pdf* target_func, pdf* proposal,int init_step,cha
}
//for writing on the run
int gate=1000;
int gate=_bunchSize;
if(i%gate==0)
{
chain_running.open (chain_run_name, fstream::in | fstream::out | fstream::app);
......
......@@ -14,7 +14,7 @@ MCMC_sampler::MCMC_sampler()
MCMC_sampler::MCMC_sampler(int dim_in,int length_in, bool verbose):
_dim(dim_in), _length(length_in), _verbose(verbose)
_dim(dim_in), _length(length_in), _verbose(verbose),_bunchSize(1000)
{
HepVector col(dim_in,0.0);
vector<HepVector > matrix(length_in,col);
......
......@@ -36,7 +36,8 @@ class MCMC_sampler{
std::vector<std::vector<double> > _add_chain; //for extra par
bool _add_flag; //for extra par
HepVector _starting_point;
unsigned long _bunchSize;
std::vector<int> _vec_flag_acc; //vector of 0 and 1. This can be used for calculating both acc rate and recurrence of the chain.
......@@ -121,7 +122,7 @@ class MCMC_sampler{
void Set_starting_point(HepVector a);
void Set_t0(double t0) {_t0=t0;}
void Set_ts(double ts) {_ts=ts;}
void SetBunchSize(const unsigned long b){_bunchSize=b;}
//verbose
......
......@@ -55,6 +55,8 @@ int main(int argc, char *argv[])
bool verbose=parser.params.find<bool>("verbose",false);
const char* target_cor=target_cor_path.c_str();
const unsigned long bunchSize=parser.params.find<unsigned long>("bunchSize",1000);
const int seed=parser.params.find<int>("seed",length);
cout <<"dim=" <<dim <<endl; //proposal dimension
......@@ -92,19 +94,20 @@ int main(int argc, char *argv[])
cout << "using Metropolis algorithm" << endl;
}
chain->SetBunchSize(bunchSize);
//directly from Parser
cout << "using Parser for setting par" << endl;
chain->set_par(parser);
cout << chain->_min_par << endl;
cout << chain->_max_par << endl;
cout << chain->_starting_point << endl;
cout << "using Parser for setting par" << endl;
chain->set_par(parser);
cout << chain->_min_par << endl;
cout << chain->_max_par << endl;
cout << chain->_starting_point << endl;
//or by hand using set/get functions
//or by hand using set/get functions
vector<double> par_err(dim);
for(int i=0;i<dim;i++)
vector<double> par_err(dim);
for(int i=0;i<dim;i++)
{
par_err[i]=chain->_par_err[i];
cout << par_err[i] <<endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment