Commit af0a209f authored by myron's avatar myron

accelerato letura h5_eli. Tolto printf

OK
parent 744b01b8
......@@ -968,8 +968,6 @@ void CCspace_reconstructSHARED(CCspace * self ,int sn, int npbunches,int ntoktr
if( self->params.DO_RING_FILTER ) {
// data = (float*) malloc((mydata_end-mydata_start)*self->params.nprojs_span * size1 *sizeof(float)) ;
printf(" TRACKER nslices_data %d mydata_start %d start_slice_2s %d \n", nslices_data, mydata_start, start_slice_2s ) ;
if( self->params.RING_FILTER_KIND == RING_Filter_ID ) {
if (self->params.verbosity>0) printf(" ring_filter \n" );
CCspace_RING_Filter_implementation(self, data,
......@@ -4852,7 +4850,6 @@ void CCspace_tranpose_chunk (CCspace * self , int sn, int ntoktreated, int
AcTypeMPI , MPI_COMM_WORLD);
printf(" VADO in MPI OK\n");
printf(" TRACKER alloco top_slice %d start_slice %d\n", top_slice,start_slice ) ;
{
......@@ -6318,22 +6315,9 @@ void CCspace_read_chunk (CCspace * self , int sn, int ntok , int npbunches,
if( 1 ) {
smax2= self->reading_infos.size_s_[ sn_nb *2+0 ] ;
smax1= self->reading_infos.size_s_[ sn_nb *2+1 ] ;
printf("ABCDself->reading_infos.Dim_2 %ld \n" , self->reading_infos.Dim_2 ) ;
printf("ABCDself->reading_infos.Dim_1 %ld \n" , self->reading_infos.Dim_1 ) ;
printf("ABCDbinning %ld \n" , binning ) ;
printf("ABCDsmax2 %ld \n" , smax2 ) ;
printf("ABCDsmax1 %ld \n" , smax1 ) ;
printf("ABCDself->reading_infos.datatype %ld \n" , self->reading_infos.datatype ) ;
printf("ABCDsize self->reading_infos.datatype %ld \n" , sizeofdatatype[self->reading_infos.datatype ] ) ;
// exit(0);
buffer= (char*) malloc(max( self->reading_infos.Dim_2*self->reading_infos.Dim_1 , binning*binning*smax2*smax1)
*max( sizeof(float), sizeofdatatype[ self->reading_infos.datatype ] ) );
if( rotation_vertical==0 ) {
/* for trasposition */
}
......@@ -6402,6 +6386,9 @@ void CCspace_read_chunk (CCspace * self , int sn, int ntok , int npbunches,
int hfd5stack_done = 0;
hid_t h5file_id = -1 ;
hid_t h5ds_id = -1 ;
for(npj=pstart; npj<pend ; npj++) {
// printf(" NPJ %d %d %d\n", npj,size_s_[2*sn_nb +0],size_s_[2*sn_nb +1]);
float *target;
......@@ -6536,7 +6523,6 @@ void CCspace_read_chunk (CCspace * self , int sn, int ntok , int npbunches,
if( self->reading_infos.ff_file_list_lenght == 1 ) {
multiplo = 0 ;
}
printf("FFFFFFFFFFFF VADO A LEGGER in pos %d %d %d %s \n", posff - file_seq_pos , posff , file_seq_pos , self->reading_infos.ff_file_list[file_seq_pos] );
read_data_from_h5(self->reading_infos.ff_file_list[file_seq_pos] ,
self->reading_infos.ff_h5_dsname,
......@@ -6572,7 +6558,8 @@ void CCspace_read_chunk (CCspace * self , int sn, int ntok , int npbunches,
self->params.DOUBLEFFCORRECTION!=NULL ,
self->params.TAKE_LOGARITHM,
self->ffcorr,
&(self->filereading_sem)
&h5file_id,
&h5ds_id
);
}// fine conico con H5
......@@ -6706,7 +6693,12 @@ void CCspace_read_chunk (CCspace * self , int sn, int ntok , int npbunches,
}
}
}
if( h5file_id >= 0 ) {
H5Dclose( h5ds_id );
H5Fclose( h5file_id );
}
}
if(buffer) free(buffer);
{
int iff;
......
......@@ -402,11 +402,6 @@ Cspace_new( PyObject *self, PyObject *args)
Cspace* res;
char * CCD_FILTER_ptr;
char * RING_FILTER_ptr;
H5Eset_auto1 (my_hdf5_error_handler, NULL);
res= (Cspace*) PyObject_NEW(Cspace , &Cspacetype);
res->myCCspace = (CCspace*) malloc(sizeof( CCspace));
......
......@@ -45,10 +45,7 @@
#include<unistd.h>
#include"CCspace.h"
#define H5Dopen_vers 1
///// temporary discativation
#include <hdf5.h>
#undef NDEBUG
#include<assert.h>
......@@ -380,14 +377,6 @@ void extended_fread( char *ptr, /* memory to write in */
}
}
herr_t my_hdf5_error_handler2 (void *unused)
{
fprintf (stderr, "An HDF5 error was detected. Bye.\n");
exit (1);
}
void read_data_from_h5( char * filename,
char * dsname,
......@@ -413,7 +402,6 @@ void read_data_from_h5( char * filename,
herr_t status;
int rank ;
H5Eset_auto1 (my_hdf5_error_handler2, NULL);
assert(binning==1);
......@@ -441,11 +429,6 @@ void read_data_from_h5( char * filename,
offset[0] = nproj;
offset[1] = pos0;
offset[2] = pos1;
printf(" ofsets %d %d %d \n", nproj, pos0, pos1 ) ;
int v_span = 1;
if(multiplo) {
......@@ -453,8 +436,6 @@ void read_data_from_h5( char * filename,
}
printf(" count %d %d %d \n", v_span, size0 , size1 ) ;
count[0] = v_span ;
count[1] = size0;
count[2] = size1;
......@@ -465,10 +446,6 @@ void read_data_from_h5( char * filename,
/*
* descrive la memoria su cui scrivo
*/
printf(" dimsm %d %d %d \n", v_span, size0 , size1 ) ;
dimsm[0] = v_span;
dimsm[1] = size0;
dimsm[2] = size1 ;
......@@ -546,19 +523,17 @@ void read_data_from_h5_eli( char * filename,
int doubleffcorrection,
int takelog,
float *ffcorr,
sem_t * semaforo_ptr
hid_t *file,
hid_t *dataset
) {
assert(binning==1);
long int i, j ;
/* int dims[1],strides[1]; */
/* FILE *edffile; */
/* int res; */
for(i=0; i < size0; i++){
for(j=0; j < size1; j++){
......@@ -566,8 +541,6 @@ void read_data_from_h5_eli( char * filename,
}
}
hid_t file; /* handles */
hid_t dataset;
hid_t memspace;
hid_t dataspace;
hsize_t dimsm[3]; /* dataset and chunk dimensions*/
......@@ -577,17 +550,16 @@ void read_data_from_h5_eli( char * filename,
hsize_t offset_out[3];
herr_t status;
int rank ;
float shift = nproj * DZPERPROJ;
int ishift = ((int) shift);
shift = shift-ishift; // si assume dzperproj sempre positivo
pos0 = pos0 -ishift ;
int pos0_ = pos0-1;
int pos0_clipped=pos0;
if(pos0<0) pos0_clipped=0;
int pos0_clipped_ = pos0_;
if(pos0_<0) pos0_clipped_=0;
int size0_clipped = size0;
......@@ -595,16 +567,17 @@ void read_data_from_h5_eli( char * filename,
size0_clipped = size1 - pos0;
}
int size0_clipped_ = size0_clipped+ 1 ;
if( pos0_ + size0_clipped_ >= pos0_clipped_ ) {
sem_wait( semaforo_ptr );
printf(" reading %s dataset %s at nproj %d \n", filename, dsname, nproj ) ;
file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
dataset = H5Dopen(file, dsname);
if(*file<0) {
*file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
*dataset = H5Dopen(*file, dsname);
}
dataspace = H5Dget_space(dataset);
dataspace = H5Dget_space(*dataset);
rank = H5Sget_simple_extent_ndims(dataspace);
assert(rank==3);
......@@ -614,15 +587,14 @@ void read_data_from_h5_eli( char * filename,
/*
* descrive quale parte del dataset leggo
*/
printf(" ofsets %d %d %d \n", nproj, pos0_clipped_, pos1 ) ;
offset[0] = nproj;
offset[1] = pos0_clipped_;
offset[2] = pos1;
int v_span = 1;
printf(" count %d %d %d \n", v_span, size0_clipped_-(pos0_clipped_-pos0_) , size1 ) ;
......@@ -636,10 +608,8 @@ void read_data_from_h5_eli( char * filename,
/*
* descrive la memoria su cui scrivo
*/
printf(" dimsm %d %d %d \n", v_span, size0_clipped_-(pos0_clipped_-pos0_) , size1 ) ;
dimsm[0] = v_span;
dimsm[1] = size0_clipped_-(pos0_clipped_-pos0_);
......@@ -648,7 +618,7 @@ void read_data_from_h5_eli( char * filename,
/*
* descrive quale parte di memoria scrivo
*/
*/
offset_out[0] = 0;
offset_out[1] = 0;
offset_out[2] = 0;
......@@ -665,23 +635,17 @@ void read_data_from_h5_eli( char * filename,
float *mytarget;
mytarget = (float *) malloc( v_span*( size0_clipped_ )*size1* sizeof(float)) ;
status = H5Dread(dataset, H5T_NATIVE_FLOAT, memspace, dataspace,
status = H5Dread(*dataset, H5T_NATIVE_FLOAT, memspace, dataspace,
H5P_DEFAULT, mytarget +(pos0_clipped_-pos0_)*size1 );
H5Dclose(dataset);
H5Sclose(dataspace);
H5Sclose(memspace);
H5Fclose(file);
sem_post( semaforo_ptr );
if(pos0_clipped_-pos0_) {
memset( mytarget , 0, (pos0_clipped_-pos0_)* sizeof(float) *((long int) size1) );
}
for(j=0; j< size0_clipped_ ; j++){
for(i=0; i< size1 ; i++){
if((j+pos0_)>=0) {
......@@ -734,7 +698,7 @@ void read_data_from_h5_eli( char * filename,
}
} else {
}
sem_post( semaforo_ptr );
}
......
......@@ -31,6 +31,9 @@
#############################################################################*/
#include<semaphore.h>
#define H5Dopen_vers 1
#include <hdf5.h>
#define LowByteFirst 1
......@@ -141,7 +144,6 @@ void read_data_from_h5_eli( char * filename,
long int size0 , long int size1,
int rotation_vertical,
int binning,
float DZPERPROJ,
float *Ddark,
int correct_ff,
......@@ -150,12 +152,14 @@ void read_data_from_h5_eli( char * filename,
int doubleffcorrection,
int takelog,
float *ffcorr,
sem_t * semaforo_ptr
hid_t *file,
hid_t *dataset
) ;
void write_data_to_edf( float *SLICE, int num_y,int num_x, const char * nomeout ) ;
......
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