Commit 0eccb5ae authored by test's avatar test Committed by Alessandro Mirone

Paganin FFT 2 projections by 2 projections

corrige' le nom de paganin_out files

limite sur le nombre de fichiers ouverts en lecture avec un semaphore
parent 1b89e472
......@@ -275,7 +275,7 @@ class Control:
if possibility is None:
break
if possibility==-1:
time.sleep(0.1)
time.sleep(0.001)
continue
packetSerialNumber, processingObject = possibility
......
This diff is collapsed.
......@@ -1193,6 +1193,9 @@ struct CCspace_struct{
sem_t gpustat_med_sem;
sem_t islicetracker_sem;
sem_t proupdate_sem;
sem_t filereading_sem;
Gpu_Context * gpu_context;
Gpu_pag_Context * gpu_pag_context;
Gpu_med_Context * gpu_med_context;
......
......@@ -490,7 +490,8 @@ void read_data_from_edf( char * filename,
int sizeofdatatype,
int Dim_2, int Dim_1,
int filebyteorder,
int binning
int binning,
sem_t * semaforo_ptr
) {
char *target;
float * target_float ;
......@@ -501,8 +502,11 @@ void read_data_from_edf( char * filename,
int res;
// printf(" apro %s filedatatype %d sizeofdatatype %d \n", filename, filedatatype , sizeofdatatype );
sem_wait( semaforo_ptr );
edffile = fopen( filename ,"r");
if(edffile==NULL) {
sem_post( semaforo_ptr );
fprintf(stderr," error opening %s for reading \n", filename );
exit(1);
}
......@@ -531,6 +535,7 @@ void read_data_from_edf( char * filename,
printf(" headerSize %ld sizeofdatatype %d size1 %ld binning %d %ld \n", headerSize , sizeofdatatype , size1 , binning , headerSize + ((long int )(pos0_clipped *(size1*binning) *sizeofdatatype )));
fprintf(stderr," error positioning cursor in file %s for reading a chunk\n", filename );
sem_post( semaforo_ptr );
exit(1);
}
res=fread ( target + (pos0_clipped-pos0)* sizeofdatatype *((long int) size1) * binning*binning ,
......@@ -540,6 +545,7 @@ void read_data_from_edf( char * filename,
);
if(res!=1) {
fprintf(stderr," error reading a chunk fromfile %s res was %d\n", filename , res);
sem_post( semaforo_ptr );
exit(1);
}
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
......@@ -549,6 +555,7 @@ void read_data_from_edf( char * filename,
SEEK_SET );
if(res!=0) {
fprintf(stderr," error positioning cursor in file %s for reading a chunk ( rotation horizontal) \n", filename );
sem_post( semaforo_ptr );
exit(1);
}
......@@ -561,10 +568,13 @@ void read_data_from_edf( char * filename,
strides ,
edffile );
} else {
sem_post( semaforo_ptr );
fprintf(stderr," ROTATION_VERTICAL MUST BE EITHER 1 or 0 . Was %d . Now stopping\n", rotation_vertical);
exit(1);
}
fclose(edffile);
sem_post( semaforo_ptr );
if(pos0_clipped-pos0) memset( target , 0, (pos0_clipped-pos0)* sizeofdatatype *((long int) size1) * binning*binning );
if(size0-size0_clipped) memset( target + ( (pos0_clipped-pos0)+ size0_clipped) * sizeofdatatype *((long int) size1) * binning*binning ,
......@@ -675,7 +685,8 @@ void read_data_from_edf_eli( char * filename,
int takelog,
float *ffcorr,
float *currents,
float curr
float curr,
sem_t * semaforo_pt
) {
long int i, j, nbytes, n1,n2, k,l;
char bsw;
......@@ -689,8 +700,11 @@ void read_data_from_edf_eli( char * filename,
char *buffer = (char *) malloc((size0+1)*Dim_1*sizeof(float)) ;
// printf(" apro %s filedatatype %d sizeofdatatype %d \n", filename, filedatatype , sizeofdatatype );
sem_wait( semaforo_ptr );
edffile = fopen( filename ,"r");
if(edffile==NULL) {
sem_post( semaforo_ptr );
fprintf(stderr," error opening %s for reading \n", filename );
exit(1);
}
......@@ -726,6 +740,7 @@ void read_data_from_edf_eli( char * filename,
headerSize + ((long int )(pos0_clipped_ *binning*(size1*binning) *sizeofdatatype)),
SEEK_SET );
if(res!=0) {
sem_post( semaforo_ptr );
fprintf(stderr," error positioning cursor in file %s for reading a chunk\n", filename );
exit(1);
}
......@@ -739,6 +754,7 @@ void read_data_from_edf_eli( char * filename,
);
if(res!=1) {
fprintf(stderr," error reading a chunk fromfile %s res was %d\n", filename , res);
sem_post( semaforo_ptr );
exit(1);
}
/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
......@@ -747,6 +763,7 @@ void read_data_from_edf_eli( char * filename,
headerSize + binning*pos0_clipped * sizeofdatatype ,
SEEK_SET );
if(res!=0) {
sem_post( semaforo_ptr );
fprintf(stderr," error positioning cursor in file %s for reading a chunk ( rotation horizontal) \n", filename );
exit(1);
}
......@@ -761,9 +778,11 @@ void read_data_from_edf_eli( char * filename,
edffile );
} else {
fprintf(stderr," ROTATION_VERTICAL MUST BE EITHER 1 or 0 . Was %d . Now stopping\n", rotation_vertical);
sem_post( semaforo_ptr );
exit(1);
}
fclose(edffile);
sem_post( semaforo_ptr );
}
// printf(" DEBUG 1 \n");
if( filebyteorder != byteorder () ) {
......
......@@ -29,6 +29,10 @@
# Please contact the ESRF industrial unit (industry@esrf.fr) if this license
# is a problem for you.
#############################################################################*/
#include<semaphore.h>
#define LowByteFirst 1
#define HighByteFirst 0
#define UnsignedShort 0
......@@ -73,7 +77,8 @@ void read_data_from_edf( char * filename,
int Dim_2,
int Dim_1,
int filebyteorder,
int binning
int binning,
sem_t * semaforo
);
......@@ -108,7 +113,8 @@ void read_data_from_edf_eli( char * filename,
int takelog,
float *ffcorr,
float *currents,
float curr
float curr,
sem_t * semaforo
);
......
......@@ -6548,6 +6548,7 @@ __global__ static void multi_pro_gputomo_conicity_kernel(float *d_SINO, // da
float Xcorner = (d_axis_s[projection]-SOURCE_X)/(magnicenter*v2x) +
( cpu_offset_x *cos_angle - cpu_offset_y * sin_angle ) ;
float Ycorner = axis_position_v*0 +
( cpu_offset_x *sin_angle + cpu_offset_y * cos_angle ) ;
......
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