diff --git a/scripts/delete_old_files_in_buffer.sh b/scripts/delete_old_files_in_buffer.sh index 1d0db5a..ddcfed1 100755 --- a/scripts/delete_old_files_in_buffer.sh +++ b/scripts/delete_old_files_in_buffer.sh @@ -26,5 +26,5 @@ then exit fi -#find /gpfs/photonics/swissfel/buffer/JF* -type f -mmin +$((${hours}*60)) -delete +find /gpfs/photonics/swissfel/buffer/JF* -type f -mmin +$((${hours}*60)) -delete find /gpfs/photonics/swissfel/buffer/JF*/M* -type d -mmin +$((${hours}*60)) -delete diff --git a/scripts/retrieve_detector_data.sh b/scripts/retrieve_detector_data.sh index d4512d3..d1b38c0 100755 --- a/scripts/retrieve_detector_data.sh +++ b/scripts/retrieve_detector_data.sh @@ -16,8 +16,6 @@ echo "Request to retrieve : $@ " echo "Started : "`date` date1=$(date +%s) -PROCESS_PID=$$ - if [ $# == 4 ] then OUTFILE=$4 @@ -25,6 +23,20 @@ else OUTFILE=/gpfs/photonics/swissfel/buffer/test.${START_PULSE_ID}-${STOP_PULSE_ID}.h5 fi +case ${DETECTOR} in +'JF01T03V01') + NM=3 + ;; +'JF07T32V01') + NM=32 + ;; +'JF13T01V01') + NM=1 + ;; +*) + NM=1 +esac + #8 replay workers per core #coreAssociated_replay=(20 20 20 20 20 20 20 20 21 21 21 21 21 21 21 21 22 22 22 22 22 22 22 22 23 23 23 23 23 23 23 23) #4 replay workers per core @@ -34,7 +46,8 @@ coreAssociated_replay=(7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 11 11 11 11 12 12 12 #1 replay workers per core #coreAssociated_replay=(4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35) -coreAssociated_writer="2,3,4,5,6" +#coreAssociated="7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14" +coreAssociated="7,8,9,10,11,12,13,14" touch /tmp/detector_retrieve.log /tmp/detector_retrieve_replay.log @@ -45,8 +58,8 @@ while [ ${PREVIOUS_STILL_RUN} = 1 ] do sleep 15 # we need to sleep at least to make sure that we don't read from CURRENT file PREVIOUS_STILL_RUN=0 - ps -fe | grep "/usr/bin/sf_replay " | grep -v grep | grep sf_ > /dev/null - PREVIOUS_STILL_RUN1=$? +# ps -fe | grep "/usr/bin/sf_replay " | grep -v grep | grep sf_ > /dev/null + PREVIOUS_STILL_RUN1=1 ps -fe | grep "/usr/bin/sf_writer " | grep -v grep | grep sf_ > /dev/null PREVIOUS_STILL_RUN2=$? if [ ${PREVIOUS_STILL_RUN1} != 1 -o ${PREVIOUS_STILL_RUN2} != 1 ] @@ -62,17 +75,15 @@ echo -n "Waited Time : " echo $((date2-date1)) | awk '{print int($1/60)":"int($1%60)}' echo "Started actual retrieve : "`date` -for M in {00..31} -do - taskset -c ${coreAssociated_replay[10#${M}]} /usr/bin/sf_replay ${PROCESS_PID} ${DETECTOR} M${M} ${M} ${START_PULSE_ID} ${STOP_PULSE_ID} >> /tmp/detector_retrieve_replay.log & -done +#for M in {00..31} +#do +# taskset -c ${coreAssociated_replay[10#${M}]} /usr/bin/sf_replay ${PROCESS_PID} ${DETECTOR} M${M} ${M} ${START_PULSE_ID} ${STOP_PULSE_ID} >> /tmp/detector_retrieve_replay.log & +#done -taskset -c ${coreAssociated_writer} /usr/bin/sf_writer ${PROCESS_PID} ${OUTFILE} ${START_PULSE_ID} ${STOP_PULSE_ID} >> /tmp/detector_retrieve.log & +taskset -c ${coreAssociated} /usr/bin/sf_writer ${OUTFILE} /gpfs/photonics/swissfel/buffer/${DETECTOR} ${NM} ${START_PULSE_ID} ${STOP_PULSE_ID} >> /tmp/detector_retrieve.log & wait -rm -rf /tmp/sf-replay-${PROCESS_PID}-* - date3=$(date +%s) echo "Finished : "`date` echo -n "Retrieve Time : " diff --git a/sf-writer/src/main.cpp b/sf-writer/src/main.cpp index 76f4f79..1c8c233 100644 --- a/sf-writer/src/main.cpp +++ b/sf-writer/src/main.cpp @@ -60,13 +60,15 @@ void read_buffer( int main (int argc, char *argv[]) { - if (argc != 5) { + if (argc != 6) { cout << endl; cout << "Usage: sf_writer [output_file] [device]"; + cout << " [n_modules]"; cout << " [start_pulse_id] [stop_pulse_id]"; cout << endl; cout << "\toutput_file: Complete path to the output file." << endl; cout << "\tdevice: Name of detector." << endl; + cout << "\tn_modules: number of modules" << endl; cout << "\tstart_pulse_id: Start pulse_id of retrieval." << endl; cout << "\tstop_pulse_id: Stop pulse_id of retrieval." << endl; cout << endl; @@ -76,9 +78,10 @@ int main (int argc, char *argv[]) string output_file = string(argv[1]); const string device = string(argv[2]); - uint64_t start_pulse_id = (uint64_t) atoll(argv[3]); - uint64_t stop_pulse_id = (uint64_t) atoll(argv[4]); - size_t n_modules = 32; + size_t n_modules = atoi(argv[3]); + //size_t n_modules = 32; + uint64_t start_pulse_id = (uint64_t) atoll(argv[4]); + uint64_t stop_pulse_id = (uint64_t) atoll(argv[5]); uint64_t start_block = start_pulse_id / BUFFER_BLOCK_SIZE; uint64_t stop_block = stop_pulse_id / BUFFER_BLOCK_SIZE;