@pytest.mark.hasgpu
def test_hist(nbin_offset_dim_dtype_inp, backend_pair):
 ((nbins, offset), dim, dtype, (name, inp_gen)) = nbin_offset_dim_dtype_inp
 gpuflag = (check_gpu.get_compute_capability(0) >= 3.0)
 if (gpuflag is False):
  raise RuntimeError('Device does not have CUDA compute capability 3.0 or greater')
 (ng, nc) = backend_pair
 ng.set_hist_buffers(nbins, offset)
 nc.set_hist_buffers(nbins, offset)
 np_inp = inp_gen(dim).astype(dtype)
 np_hist = ref_hist(np_inp, nbins=nbins, offset=offset)
 for be in [ng, nc]:
  be_inp = be.array(np_inp, dtype=dtype)
  be_hist = be_inp.hist(name)
  assert tensors_allclose(np_hist, be_hist)

@ pytest . mark . hasgpu def test_hist ( nbin_offset_dim_dtype_inp , backend_pair ) : ( ( nbins , offset ) , dim , dtype , ( name , inp_gen ) ) = nbin_offset_dim_dtype_inp gpuflag = ( check_gpu . get_compute_capability ( 0 ) >= 3.0 ) if ( gpuflag is False ) : raise RuntimeError ( 'Device does not have CUDA compute capability 3.0 or greater' ) ( ng , nc ) = backend_pair ng . set_hist_buffers ( nbins , offset ) nc . set_hist_buffers ( nbins , offset ) np_inp = inp_gen ( dim ) . astype ( dtype ) np_hist = ref_hist ( np_inp , nbins = nbins , offset = offset ) for be in [ ng , nc ] : be_inp = be . array ( np_inp , dtype = dtype ) be_hist = be_inp . hist ( name ) assert tensors_allclose ( np_hist , be_hist )
compare the nervanagpu and nervanacpu hist implementation to the reference implementation above .