CyprienBosserelle / xbeach_gpu

Lightweight version of XBeach that uses CUDA C to run on the GPU. The code is used to simulate coastal waves, currents, sediment transport and beach morphology changes during extreme events. Visit:
http://cyprienbosserelle.github.io/xbeach_gpu/
GNU General Public License v3.0
13 stars 1 forks source link

Jonswap file mismatch handling #50

Open davidbenncsiro opened 1 year ago

davidbenncsiro commented 1 year ago

If there is a mismatch between wavebndtype and wavebndfile, e.g.

In the first case we see something like this (via cuda-gdb):

Initial timestep: dt=5.587320
prepare output...done
Starting Computation 

CUDA Exception: Warp Illegal Address

Thread 1 "XBGPU" received signal CUDA_EXCEPTION_14, Warp Illegal Address.
[Switching focus to CUDA kernel 0, grid 21, block (1,14,0), thread (0,14,0), device 0, sm 1, warp 7, lane 0]
0x0000000000bf9918 in thetaadvecuw2ho<<<(17,39,1),(16,16,1)>>> (nx=272, ny=612, ntheta=0, 
    dtheta=0.162210897, dx=10, dt=6.14334488, wci=0, ee=0x0, ctheta=0x0, thetaadvec=0x0)
    at /scratch1/ben29w/working_copy/XBeach/xbeach_gpu/Wave_kernel.cu:1454
1454                thetaadvec[i + 0 * nx*ny] = 0.0f;
(cuda-gdb) bt
#0  0x0000000000bf9918 in thetaadvecuw2ho<<<(17,39,1),(16,16,1)>>> (nx=272, ny=612, ntheta=0, 
    dtheta=0.162210897, dx=10, dt=6.14334488, wci=0, ee=0x0, ctheta=0x0, thetaadvec=0x0)
    at /scratch1/ben29w/working_copy/XBeach/xbeach_gpu/Wave_kernel.cu:1454

In the second case we see this kind of failure:

Generating initial wave bnd data
Generating JONSWAP spectrum: Hs=9.294000, Tp=281.531000, Dp=4.654793, gam=3600.000000, s=24.000000
Generating Boundary condition: Energy from wave group and Long bound waves.
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Thread 1 "XBGPU" received signal SIGABRT, Aborted.
0x0000155553bcdcbb in raise () from /lib64/libc.so.6
(cuda-gdb) bt
...
#9  0x0000000000472489 in std::valarray<std::complex<double> >::valarray (this=0x7ffffffeee00, 
    __n=18446744072635809791) at /usr/include/c++/7/valarray:615
#10 0x000000000046cff6 in GenWGnLBW (Param=..., nf=59, ndir=90, HRfreq=0x61d2a0, HRdir=0x674da0, 
    HRSpec=0x6ddaf0, Trep=@0x61ade8: 279.955322, qfile=@0x61ae28: 0x155512fb8010, 
    Stfile=@0x61ae10: 0x1555172fa010) at makjonswap.cpp:620
#11 0x0000000000408a0e in waveinitGPU (Param=..., wavebnd=...) at Wavestep.cu:153
#12 0x000000000041e204 in main (argc=1, argv=0x7fffffff9588) at Wave_gpu.cu:2303

Either the C++ code could do some sanity checks on the input file or the conversion script could do so in the case of XB to XBG parameter file conversion.