示例#1
0
    from galario import single_cuda as g_single
else:
    from galario import double as g_double
    from galario import single as g_single

# PARAMETERS FOR MULTIPLE TEST EXECUTIONS
par1 = {'dRA': 0., 'dDec': 0.4, 'PA': 2., 'nxy': 1024}
par2 = {'dRA': -3.5, 'dDec': 7.2, 'PA': -23., 'nxy': 2048}
par3 = {'dRA': 2.3, 'dDec': 3.2, 'PA': 88., 'nxy': 4096}
par4 = {'dRA': 0., 'dDec': 0., 'PA': 145., 'nxy': 1024}


# use last gpu if available. Check `watch -n 0.1 nvidia-smi` to see which gpu is
# used during test execution.
ngpus = g_double.ngpus()
g_double.use_gpu(0) #max(0, ngpus-1))

g_double.threads()


########################################################
#                                                      #
#                      TESTS                           #
#                                                      #
########################################################

@pytest.mark.parametrize("Rmin, dR, nrad, nxy, dxy, inc, profile_mode, real_type",
                          [(1e-6, 0.001, 2000, 1024, 0.2, 20., 'Gauss', 'float64'),
                           (1e-6, 0.001, 2000, 2048, 0.2, 44.23, 'Cos-Gauss', 'float64'),
                           (1e-6, 0.001, 2000, 2048, 0.5, 20., 'Gauss', 'float64'),
                           (1e-6, 0.001, 2000, 1024, 0.3, 20., 'Gauss', 'float64')],
示例#2
0
    default=False,
    help="If True uses Python implementation of sample/chi2 Profile/Image.")
p.add_argument("--no-verbose",
               action="store_true",
               default=False,
               help="Print timing to stdout")

options = p.parse_args()
# print(options)

if options.USE_GPU:
    if galario.HAVE_CUDA:

        from galario import double_cuda as acc_lib_cuda

        acc_lib_cuda.use_gpu(options.gpu_id)

    else:
        print("Option --gpu not valid. galario.HAVE_CUDA is {}.".format(
            galario.HAVE_CUDA))
        options.USE_GPU = False

from galario import double as acc_lib_cpu


def setup_chi2Image(nxy, nsamples):

    # these number can be freely changed for this speed test
    dRA = -3.1
    dDec = 2.5
    PA = 80.