Skip to content
Snippets Groups Projects
Commit 87b058d4 authored by Moises Fernandez's avatar Moises Fernandez
Browse files

Delete unnecessary params in Samples Record-Save

parent 37080b64
No related branches found
No related tags found
No related merge requests found
...@@ -288,7 +288,6 @@ void runmcmc_record( //INPUT ...@@ -288,7 +288,6 @@ void runmcmc_record( //INPUT
double seed, double seed,
string output_file, string output_file,
//OUTPUT //OUTPUT
thrust::device_vector<int>& multirecords_gpu,
thrust::device_vector<float>& rf0_gpu, thrust::device_vector<float>& rf0_gpu,
thrust::device_vector<float>& rtau_gpu, thrust::device_vector<float>& rtau_gpu,
thrust::device_vector<float>& rs0_gpu, thrust::device_vector<float>& rs0_gpu,
...@@ -296,8 +295,7 @@ void runmcmc_record( //INPUT ...@@ -296,8 +295,7 @@ void runmcmc_record( //INPUT
thrust::device_vector<float>& rdstd_gpu, thrust::device_vector<float>& rdstd_gpu,
thrust::device_vector<float>& rth_gpu, thrust::device_vector<float>& rth_gpu,
thrust::device_vector<float>& rph_gpu, thrust::device_vector<float>& rph_gpu,
thrust::device_vector<float>& rf_gpu, thrust::device_vector<float>& rf_gpu)
thrust::device_vector<float>& rlikelihood_energy_gpu)
{ {
xfibresOptions& opts = xfibresOptions::getInstance(); xfibresOptions& opts = xfibresOptions::getInstance();
...@@ -397,7 +395,6 @@ void runmcmc_record( //INPUT ...@@ -397,7 +395,6 @@ void runmcmc_record( //INPUT
double *signals_ptr = thrust::raw_pointer_cast(signals_gpu.data()); double *signals_ptr = thrust::raw_pointer_cast(signals_gpu.data());
double *isosignals_ptr = thrust::raw_pointer_cast(isosignals_gpu.data()); double *isosignals_ptr = thrust::raw_pointer_cast(isosignals_gpu.data());
int *multirecords_ptr = thrust::raw_pointer_cast(multirecords_gpu.data());
float *rf0_ptr = thrust::raw_pointer_cast(rf0_gpu.data()); float *rf0_ptr = thrust::raw_pointer_cast(rf0_gpu.data());
float *rtau_ptr = thrust::raw_pointer_cast(rtau_gpu.data()); float *rtau_ptr = thrust::raw_pointer_cast(rtau_gpu.data());
float *rs0_ptr = thrust::raw_pointer_cast(rs0_gpu.data()); float *rs0_ptr = thrust::raw_pointer_cast(rs0_gpu.data());
...@@ -406,7 +403,6 @@ void runmcmc_record( //INPUT ...@@ -406,7 +403,6 @@ void runmcmc_record( //INPUT
float *rth_ptr = thrust::raw_pointer_cast(rth_gpu.data()); float *rth_ptr = thrust::raw_pointer_cast(rth_gpu.data());
float *rph_ptr = thrust::raw_pointer_cast(rph_gpu.data()); float *rph_ptr = thrust::raw_pointer_cast(rph_gpu.data());
float *rf_ptr = thrust::raw_pointer_cast(rf_gpu.data()); float *rf_ptr = thrust::raw_pointer_cast(rf_gpu.data());
float *rlikelihood_energy_ptr = thrust::raw_pointer_cast(rlikelihood_energy_gpu.data());
int amount_shared = (THREADS_BLOCK_MCMC+1)*sizeof(double) + (10*nfib + 2*nparams + 24)*sizeof(float) + (7*nfib + 18)*sizeof(int); int amount_shared = (THREADS_BLOCK_MCMC+1)*sizeof(double) + (10*nfib + 2*nparams + 24)*sizeof(float) + (7*nfib + 18)*sizeof(int);
...@@ -434,7 +430,7 @@ void runmcmc_record( //INPUT ...@@ -434,7 +430,7 @@ void runmcmc_record( //INPUT
gettimeofday(&t1,NULL); gettimeofday(&t1,NULL);
runmcmc_record_kernel<<< Dim_Grid, Dim_Block, amount_shared >>>(datam_ptr, bvals_ptr, alpha_ptr, beta_ptr, fibres_ptr, multifibres_ptr, signals_ptr, isosignals_ptr, randomsN_ptr, randomsU_ptr, ndirections, nfib, nparams, opts.modelnum.value(), opts.fudge.value(), opts.f0.value(), opts.ardf0.value(), !opts.no_ard.value(), opts.rician.value(), opts.updateproposalevery.value(), iters_step, (i*iters_step), opts.nburn.value(), opts.sampleevery.value(), totalrecords, multirecords_ptr, rf0_ptr, rtau_ptr, rs0_ptr, rd_ptr, rdstd_ptr, rth_ptr, rph_ptr, rf_ptr, rlikelihood_energy_ptr); runmcmc_record_kernel<<< Dim_Grid, Dim_Block, amount_shared >>>(datam_ptr, bvals_ptr, alpha_ptr, beta_ptr, fibres_ptr, multifibres_ptr, signals_ptr, isosignals_ptr, randomsN_ptr, randomsU_ptr, ndirections, nfib, nparams, opts.modelnum.value(), opts.fudge.value(), opts.f0.value(), opts.ardf0.value(), !opts.no_ard.value(), opts.rician.value(), opts.updateproposalevery.value(), iters_step, (i*iters_step), opts.nburn.value(), opts.sampleevery.value(), totalrecords, rf0_ptr, rtau_ptr, rs0_ptr, rd_ptr, rdstd_ptr, rth_ptr, rph_ptr, rf_ptr);
sync_check("runmcmc_record_kernel"); sync_check("runmcmc_record_kernel");
gettimeofday(&t2,NULL); gettimeofday(&t2,NULL);
...@@ -464,7 +460,7 @@ void runmcmc_record( //INPUT ...@@ -464,7 +460,7 @@ void runmcmc_record( //INPUT
gettimeofday(&t1,NULL); gettimeofday(&t1,NULL);
if(nvox!=0){ if(nvox!=0){
runmcmc_record_kernel<<< Dim_Grid, Dim_Block, amount_shared >>>(datam_ptr, bvals_ptr, alpha_ptr, beta_ptr, fibres_ptr, multifibres_ptr, signals_ptr, isosignals_ptr, randomsN_ptr, randomsU_ptr, ndirections, nfib, nparams, opts.modelnum.value(), opts.fudge.value(), opts.f0.value(), opts.ardf0.value(), !opts.no_ard.value(), opts.rician.value(), opts.updateproposalevery.value(), last_step, (steps*iters_step), opts.nburn.value(), opts.sampleevery.value(), totalrecords, multirecords_ptr, rf0_ptr, rtau_ptr, rs0_ptr, rd_ptr, rdstd_ptr, rth_ptr, rph_ptr, rf_ptr, rlikelihood_energy_ptr); runmcmc_record_kernel<<< Dim_Grid, Dim_Block, amount_shared >>>(datam_ptr, bvals_ptr, alpha_ptr, beta_ptr, fibres_ptr, multifibres_ptr, signals_ptr, isosignals_ptr, randomsN_ptr, randomsU_ptr, ndirections, nfib, nparams, opts.modelnum.value(), opts.fudge.value(), opts.f0.value(), opts.ardf0.value(), !opts.no_ard.value(), opts.rician.value(), opts.updateproposalevery.value(), last_step, (steps*iters_step), opts.nburn.value(), opts.sampleevery.value(), totalrecords,rf0_ptr, rtau_ptr, rs0_ptr, rd_ptr, rdstd_ptr, rth_ptr, rph_ptr, rf_ptr);
sync_check("runmcmc_record_kernel"); sync_check("runmcmc_record_kernel");
} }
......
...@@ -53,7 +53,6 @@ void runmcmc_record( //INPUT ...@@ -53,7 +53,6 @@ void runmcmc_record( //INPUT
double seed, double seed,
string output_file, string output_file,
//OUTPUT //OUTPUT
thrust::device_vector<int>& multirecords_gpu,
thrust::device_vector<float>& rf0_gpu, thrust::device_vector<float>& rf0_gpu,
thrust::device_vector<float>& rtau_gpu, thrust::device_vector<float>& rtau_gpu,
thrust::device_vector<float>& rs0_gpu, thrust::device_vector<float>& rs0_gpu,
...@@ -61,5 +60,4 @@ void runmcmc_record( //INPUT ...@@ -61,5 +60,4 @@ void runmcmc_record( //INPUT
thrust::device_vector<float>& rdstd_gpu, thrust::device_vector<float>& rdstd_gpu,
thrust::device_vector<float>& rth_gpu, thrust::device_vector<float>& rth_gpu,
thrust::device_vector<float>& rph_gpu, thrust::device_vector<float>& rph_gpu,
thrust::device_vector<float>& rf_gpu, thrust::device_vector<float>& rf_gpu);
thrust::device_vector<float>& rlikelihood_energy_gpu);
...@@ -17,7 +17,7 @@ using namespace Xfibres; ...@@ -17,7 +17,7 @@ using namespace Xfibres;
// MCMC SAMPLE STORAGE // MCMC SAMPLE STORAGE
//////////////////////////////////////////// ////////////////////////////////////////////
Samples::Samples(int nvoxels,int nmeasures): Samples::Samples(int nvoxels,int nsamples):
opts(xfibresOptions::getInstance()){ opts(xfibresOptions::getInstance()){
/////////////// GPU version ///////////////////// /////////////// GPU version /////////////////////
...@@ -33,23 +33,11 @@ opts(xfibresOptions::getInstance()){ ...@@ -33,23 +33,11 @@ opts(xfibresOptions::getInstance()){
m_sum_lam=new vector<float> [nvoxels]; m_sum_lam=new vector<float> [nvoxels];
//////////////////////////////////////////////// ////////////////////////////////////////////////
//m_beenhere=m_vol2matrixkey*0;
int count=0;
int nsamples=0;
for(int i=0;i<opts.njumps.value();i++){
count++;
if(count==opts.sampleevery.value()){
count=0;nsamples++;
}
}
m_dsamples.ReSize(nsamples,nvoxels); m_dsamples.ReSize(nsamples,nvoxels);
m_dsamples=0; m_dsamples=0;
m_S0samples.ReSize(nsamples,nvoxels); m_S0samples.ReSize(nsamples,nvoxels);
m_S0samples=0; m_S0samples=0;
m_lik_energy.ReSize(nsamples,nvoxels);
m_mean_dsamples.ReSize(nvoxels); m_mean_dsamples.ReSize(nvoxels);
m_mean_dsamples=0; m_mean_dsamples=0;
m_mean_S0samples.ReSize(nvoxels); m_mean_S0samples.ReSize(nvoxels);
...@@ -133,7 +121,7 @@ opts(xfibresOptions::getInstance()){ ...@@ -133,7 +121,7 @@ opts(xfibresOptions::getInstance()){
} }
//new version for GPU //new version for GPU
void Samples::record(float rd,float rf0,float rtau,float rdstd,float rs0,float rlikelihood_energy, float *rth,float *rph, float *rf, int vox, int samp){ void Samples::record(float rd,float rf0,float rtau,float rdstd,float rs0,float *rth,float *rph, float *rf, int vox, int samp){
m_dsamples(samp,vox)=rd; m_dsamples(samp,vox)=rd;
m_sum_d[vox-1]+=rd; m_sum_d[vox-1]+=rd;
...@@ -151,7 +139,7 @@ void Samples::record(float rd,float rf0,float rtau,float rdstd,float rs0,float r ...@@ -151,7 +139,7 @@ void Samples::record(float rd,float rf0,float rtau,float rdstd,float rs0,float r
m_S0samples(samp,vox)=rs0; m_S0samples(samp,vox)=rs0;
m_sum_S0[vox-1]+=rs0; m_sum_S0[vox-1]+=rs0;
m_lik_energy(samp,vox)=rlikelihood_energy;
for(int f=0;f<opts.nfibres.value();f++){ for(int f=0;f<opts.nfibres.value();f++){
float th=rth[f]; float th=rth[f];
float ph=rph[f]; float ph=rph[f];
......
...@@ -23,7 +23,6 @@ class Samples{ ...@@ -23,7 +23,6 @@ class Samples{
Matrix m_d_stdsamples; Matrix m_d_stdsamples;
Matrix m_S0samples; Matrix m_S0samples;
Matrix m_f0samples; Matrix m_f0samples;
Matrix m_lik_energy;
// // storing signal // // storing signal
// Matrix m_mean_sig; // Matrix m_mean_sig;
...@@ -74,7 +73,7 @@ class Samples{ ...@@ -74,7 +73,7 @@ class Samples{
Samples(int nvoxels,int nmeasures); Samples(int nvoxels,int nmeasures);
void record(float rd,float rf0,float rtau,float rdstd,float rs0,float rlikelihood_energy, float *rth,float *rph, float *rf, int vox, int samp); void record(float rd,float rf0,float rtau,float rdstd,float rs0,float *rth,float *rph, float *rf, int vox, int samp);
void finish_voxel(int vox); void finish_voxel(int vox);
......
...@@ -91,7 +91,6 @@ void prepare_data_gpu_MCMC( //INPUT ...@@ -91,7 +91,6 @@ void prepare_data_gpu_MCMC( //INPUT
void prepare_data_gpu_MCMC_record( //INPUT void prepare_data_gpu_MCMC_record( //INPUT
int nvox, int nvox,
//OUTPUT //OUTPUT
thrust::device_vector<int>& multirecords_gpu,
thrust::device_vector<float>& rf0_gpu, thrust::device_vector<float>& rf0_gpu,
thrust::device_vector<float>& rtau_gpu, thrust::device_vector<float>& rtau_gpu,
thrust::device_vector<float>& rs0_gpu, thrust::device_vector<float>& rs0_gpu,
...@@ -99,12 +98,10 @@ void prepare_data_gpu_MCMC_record( //INPUT ...@@ -99,12 +98,10 @@ void prepare_data_gpu_MCMC_record( //INPUT
thrust::device_vector<float>& rdstd_gpu, thrust::device_vector<float>& rdstd_gpu,
thrust::device_vector<float>& rth_gpu, thrust::device_vector<float>& rth_gpu,
thrust::device_vector<float>& rph_gpu, thrust::device_vector<float>& rph_gpu,
thrust::device_vector<float>& rf_gpu, thrust::device_vector<float>& rf_gpu);
thrust::device_vector<float>& rlikelihood_energy_gpu);
//implemented and used in xfibres_gpu.cu //implemented and used in xfibres_gpu.cu
void record_finish_voxels( //INPUT void record_finish_voxels( //INPUT
thrust::device_vector<int>& multirecords_gpu,
thrust::device_vector<float>& rf0_gpu, thrust::device_vector<float>& rf0_gpu,
thrust::device_vector<float>& rtau_gpu, thrust::device_vector<float>& rtau_gpu,
thrust::device_vector<float>& rs0_gpu, thrust::device_vector<float>& rs0_gpu,
...@@ -113,8 +110,6 @@ void record_finish_voxels( //INPUT ...@@ -113,8 +110,6 @@ void record_finish_voxels( //INPUT
thrust::device_vector<float>& rth_gpu, thrust::device_vector<float>& rth_gpu,
thrust::device_vector<float>& rph_gpu, thrust::device_vector<float>& rph_gpu,
thrust::device_vector<float>& rf_gpu, thrust::device_vector<float>& rf_gpu,
thrust::device_vector<float>& rlikelihood_energy_gpu,
int nvox, int nvox,
int ndirections,
int idpart); int idpart);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment