msummersgill / RfCWT

R package porting the fast Continuous Wavelet Transform (fCWT)
0 stars 0 forks source link

FFTW System Wisdom Cache Support #2

Open msummersgill opened 1 year ago

msummersgill commented 1 year ago

At this time, the system wisdom cache will be read, but will not override the designed behavior of plan file usage by the original fCWT authors. This can result in unnecessarily re-computing plans and saving to local files even if a equivalent exists in the system wisdom cache at /etc/fftw/wisdomf.

Eventual Planned Functionality:

Using the fftwf-wisdom utility to pre-generate plans that can be used system wide can improve performance at run time. Generating the full canonical set of cases using fftw-wisdom -v -c -o wisdom takes many hours, but for the purposes of this library, we only need a subset of plans.

RfCWT::GenerateWisdom() is provided as a convenience function to generate the fftwf-wisdom commands for a defined set of threads. By default, the commands are printed to the console output, but specifying Execute = TRUE will use system(..., wait = FALSE) to execute them directly in parallel. Upon completion, the files can all be combined using the output of RfCWT::CombineWisdom().

RfCWT::GenerateWisdom(Threads = c(2L,4L,8L,16L), Execute = FALSE)
RfCWT::CombineWisdom(Threads = c(2L,4L,8L,16L), Execute = FALSE) 

Output of these commands is as follows. Upon completion, the user will need to generate the default directory for FFTW wisdom - /etc/fftw - if it does not exist, and then copy the output to this location.

fftwf-wisdom -p -v -T 1 -o wisdomf1 rof2048 cof2048 rob2048 cob2048 rof4096 cof4096 rob4096 cob4096 rof8192 cof8192 rob8192 cob8192 rof16384 cof16384 rob16384 cob16384 rof32768 cof32768 rob32768 cob32768 rof65536 cof65536 rob65536 cob65536 rof131072 cof131072 rob131072 cob131072 rof262144 cof262144 rob262144 cob262144 rof524288 cof524288 rob524288 cob524288 rof1048576 cof1048576 rob1048576 cob1048576
fftwf-wisdom -p -v -T 2 -w wisdomf2 -o wisdomf rof2048 cof2048 rob2048 cob2048 rof4096 cof4096 rob4096 cob4096 rof8192 cof8192 rob8192 cob8192 rof16384 cof16384 rob16384 cob16384 rof32768 cof32768 rob32768 cob32768 rof65536 cof65536 rob65536 cob65536 rof131072 cof131072 rob131072 cob131072 rof262144 cof262144 rob262144 cob262144 rof524288 cof524288 rob524288 cob524288 rof1048576 cof1048576 rob1048576 cob1048576
fftwf-wisdom -p -v -T 4 -w wisdomf4 -o wisdomf rof2048 cof2048 rob2048 cob2048 rof4096 cof4096 rob4096 cob4096 rof8192 cof8192 rob8192 cob8192 rof16384 cof16384 rob16384 cob16384 rof32768 cof32768 rob32768 cob32768 rof65536 cof65536 rob65536 cob65536 rof131072 cof131072 rob131072 cob131072 rof262144 cof262144 rob262144 cob262144 rof524288 cof524288 rob524288 cob524288 rof1048576 cof1048576 rob1048576 cob1048576
fftwf-wisdom -p -v -T 8 -w wisdomf8 -o wisdomf rof2048 cof2048 rob2048 cob2048 rof4096 cof4096 rob4096 cob4096 rof8192 cof8192 rob8192 cob8192 rof16384 cof16384 rob16384 cob16384 rof32768 cof32768 rob32768 cob32768 rof65536 cof65536 rob65536 cob65536 rof131072 cof131072 rob131072 cob131072 rof262144 cof262144 rob262144 cob262144 rof524288 cof524288 rob524288 cob524288 rof1048576 cof1048576 rob1048576 cob1048576
fftwf-wisdom -p -v -T 16 -w wisdomf16 -o wisdomf rof2048 cof2048 rob2048 cob2048 rof4096 cof4096 rob4096 cob4096 rof8192 cof8192 rob8192 cob8192 rof16384 cof16384 rob16384 cob16384 rof32768 cof32768 rob32768 cob32768 rof65536 cof65536 rob65536 cob65536 rof131072 cof131072 rob131072 cob131072 rof262144 cof262144 rob262144 cob262144 rof524288 cof524288 rob524288 cob524288 rof1048576 cof1048576 rob1048576 cob1048576

fftwf-wisdom -v -T 1 -o wisdomf -w wisdomf1 -w wisdomf2 -w wisdomf4 -w wisdomf8 -w wisdomf16

sudo mkdir /etc/fftw
sudo chmod 777 /etc/fftw 
mv wisdomf /etc/fftw/wisdomf