Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resample! is slow on the gpu #106

Open
stepholinger opened this issue Feb 3, 2023 · 3 comments
Open

resample! is slow on the gpu #106

stepholinger opened this issue Feb 3, 2023 · 3 comments

Comments

@stepholinger
Copy link
Contributor

At the moment, resample! is quite slow on the gpu. Optimizing code therefore requires designing a workflow in which data is resampled before being moved to the gpu so other preprocessing steps can enjoy the gpu speedup. This may not be ideal in all cases. The example below should demonstrate the issue.

# choose original fs and new fs
fs = 100.
resample_fs = 10.

# generate some 'data'
data = rand(500,500)

# resample on cpu
C = CorrData(corr=data,fs=fs)
cpu_time = @elapsed resample!(C,resample_fs)

# resample on gpu
C = CorrData(corr=data,fs=fs) |> gpu
gpu_time = @elapsed resample!(C,resample_fs)

# print results
print("CPU time: ", cpu_time, " s\n")
print("GPU time: ", gpu_time, " s\n")

CPU time: 0.029605658 s
GPU time: 108.995494081 s
@tclements
Copy link
Collaborator

I'm a little surprised resample works on the GPU...I don't believe I wrote a version of resample specifically for the GPU, so I think there's some data transfer to/from CPU/GPU going on here that is gumming things up. The resample code just calls an FIR filter, which I do have for the GPU but is slow because it's using an FFT. All that's to say that, yes definitely can speed things up!

@stepholinger
Copy link
Contributor Author

Should we close this since it's related to #107 (comment)? The performance elements of both issues are with SeisIO, not SeisNoise. One overall fix would be to implement resample for NodalData in SeisNoise, and to eventually add GPU support for resample in general.

@tclements
Copy link
Collaborator

Let's keep this open - I think GPU resampling is different enough to keep in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants