# NOT RUN {
psf = profitMakeGaussianPSF(dim=c(100,100))
has_openCL=profitHasOpenCL()
has_fft = profitHasFFTW()
has_openMP=profitHasOpenMP()
convolver_brute = profitMakeConvolver("brute", c(400, 400), psf)
if(has_openCL){
convolver_bruteCL = profitMakeConvolver("opencl", c(400, 400), psf,
openclenv=profitOpenCLEnv())
}
if(has_fft){
convolver_fft = profitMakeConvolver("fft", c(400, 400), psf, fft_effort=1,
omp_threads=1)
}
if(has_fft & has_openMP){
convolver_fftMP = profitMakeConvolver("fft", c(400, 400), psf, fft_effort=1,
omp_threads=4)
}
model = list(
sersic = list(
xcen = c(80, 210),
ycen = c(190, 50),
mag = c(15, 13),
re = c(14, 5),
nser = c(3, 10),
ang = c(46, 80),
axrat = c(0.4, 0.6),
box = c(0.5,-0.5)
)
)
system.time(for(i in 1:10){image_brute=profitMakeModel(model=model, dim=c(300,300), psf=psf,
convopt=list(convolver=convolver_brute))$z})
if(has_openCL){
system.time(for(i in 1:10){image_bruteCL=profitMakeModel(model=model, dim=c(300,300), psf=psf,
convopt=list(convolver=convolver_bruteCL))$z})
}
if(has_fft){
system.time(for(i in 1:10){image_fft=profitMakeModel(model=model, dim=c(300,300), psf=psf,
convopt=list(convolver=convolver_fft))$z})
}
if(has_fft & has_openMP){
system.time(for(i in 1:10){image_fftMP=profitMakeModel(model=model, dim=c(300,300), psf=psf,
convopt=list(convolver=convolver_fftMP))$z})
}
magimage(image_brute)
if(has_openCL){
magimage(image_bruteCL)
magimage(image_brute-image_bruteCL)
}
if(has_fft){
magimage(image_fft)
magimage(image_brute-image_fft)
}
if(has_fft & has_openMP){
magimage(image_fftMP)
magimage(image_brute-image_fftMP)
}
# }
Run the code above in your browser using DataLab