Skip to content

Commit

Permalink
fftw_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeresh Kumar Perla authored and Neeresh Kumar Perla committed Jun 28, 2023
1 parent 158e038 commit c2fd45a
Show file tree
Hide file tree
Showing 18 changed files with 217,591 additions and 97 deletions.
31 changes: 17 additions & 14 deletions bin/pycbc_inspiral
Original file line number Diff line number Diff line change
Expand Up @@ -301,19 +301,21 @@ def template_triggers(t_num):
return out_vals_all, tparam

with ctx:
# The following FFTW specific options needed to wait until
# we were inside the scheme context.
if opt.fft_backends == 'fftw':

# Import system wisdom.
if opt.fftw_import_system_wisdom:
fft.fftw.import_sys_wisdom()
# The following FFTW specific options needed to wait until
# we were inside the scheme context.

# Read specified user-provided wisdom files
if opt.fftw_input_float_wisdom_file is not None:
fft.fftw.import_single_wisdom_from_filename(opt.fftw_input_float_wisdom_file)
# Import system wisdom.
if opt.fftw_import_system_wisdom:
fft.fftw.import_sys_wisdom()

if opt.fftw_input_double_wisdom_file is not None:
fft.fftw.import_double_wisdom_from_filename(opt.fftw_input_double_wisdom_file)
# Read specified user-provided wisdom files
if opt.fftw_input_float_wisdom_file is not None:
fft.fftw.import_single_wisdom_from_filename(opt.fftw_input_float_wisdom_file)

if opt.fftw_input_double_wisdom_file is not None:
fft.fftw.import_double_wisdom_from_filename(opt.fftw_input_double_wisdom_file)

flow = opt.low_frequency_cutoff
flen = strain_segments.freq_len
Expand Down Expand Up @@ -499,10 +501,11 @@ event_mgr.save_performance(ncores, len(segments), len(bank), run_time, tsetup)
logging.info("Writing out triggers")
event_mgr.write_events(opt.output)

if opt.fftw_output_float_wisdom_file:
fft.fftw.export_single_wisdom_to_filename(opt.fftw_output_float_wisdom_file)
if opt.fft_backends == 'fftw':
if opt.fftw_output_float_wisdom_file:
fft.fftw.export_single_wisdom_to_filename(opt.fftw_output_float_wisdom_file)

if opt.fftw_output_double_wisdom_file:
fft.fftw.export_double_wisdom_to_filename(opt.fftw_output_double_wisdom_file)
if opt.fftw_output_double_wisdom_file:
fft.fftw.export_double_wisdom_to_filename(opt.fftw_output_double_wisdom_file)

logging.info("Finished")
Binary file added examples/inspiral/COMPRESSED_BANK.hdf
Binary file not shown.
Binary file added examples/inspiral/DATA_FILE.gwf
Binary file not shown.
Binary file added examples/inspiral/H1-INSPIRAL.hdf
Binary file not shown.
Binary file not shown.
117 changes: 34 additions & 83 deletions examples/inspiral/run.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
#!/bin/bash -e

function inspiral_run {
echo -e "\\n\\n>> [`date`] Running pycbc inspiral $1:$3 with $2 threads"
# Uncomment if you want profile information
#python -m cProfile -o output_$1_$2_$3.pstats
# Test pycbc inspiral by running over GW150914 with a limited template bank
echo -e "\\n\\n>> [`date`] Getting template bank"
wget -nv -nc https://github.com/gwastro/pycbc-config/raw/master/test/inspiral/SMALLER_BANK_FOR_GW150914.hdf

#echo -e "\\n\\n>> [`date`] Compressing template bank"
#pycbc_compress_bank \
# --bank-file SMALLER_BANK_FOR_GW150914.hdf \
# --output COMPRESSED_BANK.hdf \
# --sample-rate 4096 \
# --segment-length 256 \
# --compression-algorithm mchirp \
# --psd-model aLIGOZeroDetHighPower \
# --low-frequency-cutoff 30 \
# --approximant "SEOBNRv4_ROM"

echo -e "\\n\\n>> [`date`] Creating data file"
pycbc_condition_strain \
--frame-type LOSC_STRAIN \
--sample-rate 2048 \
--pad-data 8 \
--autogating-width 0.25 \
--autogating-threshold 100 \
--autogating-cluster 0.5 \
--autogating-taper 0.25 \
--strain-high-pass 10 \
--channel-name H1:LOSC-STRAIN \
--gps-start-time 1126258578 \
--gps-end-time 1126259946 \
--output-strain-file DATA_FILE.gwf \


`which pycbc_inspiral` \
--frame-files DATA_FILE.gwf \
--sample-rate 2048 \
Expand Down Expand Up @@ -34,83 +61,7 @@ echo -e "\\n\\n>> [`date`] Running pycbc inspiral $1:$3 with $2 threads"
--channel-name H1:LOSC-STRAIN \
--gps-start-time 1126259078 \
--gps-end-time 1126259846 \
--output H1-INSPIRAL_$1_$2_$3-OUT.hdf \
--output H1-INSPIRAL.hdf \
--approximant "SPAtmplt:mtotal<4" "SEOBNRv4_ROM:mtotal<20" "SEOBNRv2_ROM_DoubleSpin:else" \
--fft-backends $1 \
--processing-scheme cpu:$2 \
--fftw-threads-backend $3 \
--use-compressed-waveforms \
--bank-file COMPRESSED_BANK.hdf \
#--verbose 2> inspiral_$1_$2_$3.log
# Uncomment above if you want logging

# Uncomment for profile pngs
#gprof2dot -f pstats output_$1_$2_$3.pstats | dot -Tpng -o $1_$2_$3.png

echo -e "\\n\\n>> [`date`] test for GW150914"
python ./check_GW150914_detection.py H1-INSPIRAL_$1_$2_$3-OUT.hdf
}


# Test pycbc inspiral by running over GW150914 with a limited template bank
echo -e "\\n\\n>> [`date`] Getting template bank"
wget -nv -nc https://github.com/gwastro/pycbc-config/raw/master/test/inspiral/SMALLER_BANK_FOR_GW150914.hdf

echo -e "\\n\\n>> [`date`] Compressing template bank"
pycbc_compress_bank --bank-file SMALLER_BANK_FOR_GW150914.hdf --output COMPRESSED_BANK.hdf --sample-rate 4096 --segment-length 256 --compression-algorithm mchirp --psd-model aLIGOZeroDetHighPower --low-frequency-cutoff 30 --approximant "SEOBNRv4_ROM"

echo -e "\\n\\n>> [`date`] Creating data file"
pycbc_condition_strain \
--frame-type LOSC \
--sample-rate 2048 \
--pad-data 8 \
--autogating-width 0.25 \
--autogating-threshold 100 \
--autogating-cluster 0.5 \
--autogating-taper 0.25 \
--strain-high-pass 10 \
--channel-name H1:LOSC-STRAIN \
--gps-start-time 1126258578 \
--gps-end-time 1126259946 \
--output-strain-file DATA_FILE.gwf \


start=`date +%s`
inspiral_run fftw 16 openmp
end=`date +%s`
runtime_fftw_openmp_16=$((end-start))

start=`date +%s`
inspiral_run fftw 16 pthreads
end=`date +%s`
runtime_fftw_pthreads_16=$((end-start))

# In all cases below the last argument is irrelevant
start=`date +%s`
inspiral_run fftw 1 openmp
end=`date +%s`
runtime_fftw_1=$((end-start))

start=`date +%s`
inspiral_run mkl 16 openmp
end=`date +%s`
runtime_mkl_16=$((end-start))

start=`date +%s`
inspiral_run mkl 1 openmp
end=`date +%s`
runtime_mkl_1=$((end-start))

# Numpy doesn't include threading. We just want it to run, it won't be fast!
start=`date +%s`
inspiral_run numpy 1 openmp
end=`date +%s`
runtime_numpy_1=$((end-start))

echo "RUN TIMES"
echo "FFTW 16 threads with openmp " ${runtime_fftw_openmp_16}
echo "FFTW 16 threads with pthreads" ${runtime_fftw_pthreads_16}
echo "FFTW single core" ${runtime_fftw_1}
echo "MKL 16 threads" ${runtime_mkl_16}
echo "MKL 1 thread" ${runtime_mkl_1}
echo "Numpy 1 thread" ${runtime_numpy_1}
--bank-file SMALLER_BANK_FOR_GW150914.hdf \
--verbose
Loading

0 comments on commit c2fd45a

Please sign in to comment.