Skip to content

Update Guided_montecarloMultiGPU_SYCLMigration to 2023 #1250

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

Merged
merged 1 commit into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <stdlib.h>
#include <string.h>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <dpct/dpct.hpp>

// includes, project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#ifndef MONTECARLO_COMMON_H
#define MONTECARLO_COMMON_H
#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <dpct/dpct.hpp>
#include <dpct/rng_utils.hpp>
#include <oneapi/mkl.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <stdio.h>
#include <stdlib.h>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <dpct/dpct.hpp>
#include <dpct/rng_utils.hpp>
#include <oneapi/mkl.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <stdio.h>
#include <stdlib.h>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <dpct/dpct.hpp>
#include <dpct/rng_utils.hpp>
#include <oneapi/mkl.hpp>
Expand Down Expand Up @@ -263,11 +263,9 @@ extern "C" void MonteCarloGPU(TOptionPlan *plan, sycl::queue *stream) {
plan->optionCount * sizeof(__TOptionData));

stream->submit([&](sycl::handler &cgh) {
sycl::accessor<real, 1, sycl::access_mode::read_write,
sycl::access::target::local>
sycl::local_accessor<real, 1>
s_SumCall_acc_ct1(sycl::range<1>(256 /*SUM_N*/), cgh);
sycl::accessor<real, 1, sycl::access_mode::read_write,
sycl::access::target::local>
sycl::local_accessor<real, 1>
s_Sum2Call_acc_ct1(sycl::range<1>(256 /*SUM_N*/), cgh);

auto plan_rngStates_ct0 = plan->rngStates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef MONTECARLO_REDUCTION_CUH
#define MONTECARLO_REDUCTION_CUH

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <dpct/dpct.hpp>

#include "MonteCarlo_common.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <stdlib.h>
#include <string.h>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

// includes, project
#include <helper_cuda.h> // helper functions (cuda error checking and initialization)
Expand Down Expand Up @@ -68,7 +68,7 @@ int adjustProblemSize(int GPU_N, int default_nOptions) {

// select problem size
for (int i = 0; i < GPU_N; i++) {
sycl::queue q_ct1 = sycl::queue(gpu_selector{});
sycl::queue q_ct1 = sycl::queue(gpu_selector_v);
auto device = q_ct1.get_device();

int Cores =
Expand All @@ -83,7 +83,7 @@ int adjustProblemSize(int GPU_N, int default_nOptions) {
}

int adjustGridSize(int GPUIndex, int defaultGridSize) {
sycl::queue q_ct1 = sycl::queue(gpu_selector{});
sycl::queue q_ct1 = sycl::queue(gpu_selector_v);
auto device = q_ct1.get_device();

int maxGridSize =
Expand Down Expand Up @@ -114,7 +114,7 @@ static CUT_THREADPROC solverThread(TOptionPlan *plan) {
// Allocate intermediate memory for MC integrator and initialize
// RNG states
sycl::queue stream = sycl::queue(
(sycl::platform(sycl::gpu_selector())
(sycl::platform(sycl::gpu_selector_v)
.get_devices(sycl::info::device_type::gpu)[plan->device]));

initMonteCarloGPU(plan, &stream);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#ifndef MONTECARLO_COMMON_H
#define MONTECARLO_COMMON_H
#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <oneapi/mkl.hpp>
#include <oneapi/mkl/rng/device.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <stdio.h>
#include <stdlib.h>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <oneapi/mkl.hpp>
#include <oneapi/mkl/rng/device.hpp>

Expand Down Expand Up @@ -105,7 +105,7 @@ extern "C" void MonteCarloCPU(TOptionValue &callValue, TOptionData optionData,
std::shared_ptr<oneapi::mkl::rng::philox4x32x10> gen;

gen = std::make_shared<oneapi::mkl::rng::philox4x32x10>(
sycl::queue(cpu_selector()), seed);
sycl::queue(cpu_selector_v), seed);
// unsigned long long seed = 1234ULL;

// checkCudaErrors(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <stdio.h>
#include <stdlib.h>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <oneapi/mkl.hpp>
#include <oneapi/mkl/rng/device.hpp>

Expand Down Expand Up @@ -249,11 +249,9 @@ extern "C" void MonteCarloGPU(TOptionPlan *plan, sycl::queue *stream) {
plan->optionCount * sizeof(__TOptionData));

stream->submit([&](sycl::handler &cgh) {
sycl::accessor<real, 1, sycl::access_mode::read_write,
sycl::access::target::local>
sycl::local_accessor<real, 1>
s_SumCall_acc_ct1(sycl::range<1>(256 /*SUM_N*/), cgh);
sycl::accessor<real, 1, sycl::access_mode::read_write,
sycl::access::target::local>
sycl::local_accessor<real, 1>
s_Sum2Call_acc_ct1(sycl::range<1>(256 /*SUM_N*/), cgh);

auto plan_rngStates_ct0 = plan->rngStates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef MONTECARLO_REDUCTION_CUH
#define MONTECARLO_REDUCTION_CUH

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

using namespace sycl;
#include "MonteCarlo_common.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <stdlib.h>
#include <string.h>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

// includes, project
#include <helper_cuda.h> // helper functions (cuda error checking and initialization)
Expand Down Expand Up @@ -68,7 +68,7 @@ int adjustProblemSize(int GPU_N, int default_nOptions) {

// select problem size
for (int i = 0; i < GPU_N; i++) {
sycl::queue q_ct1 = sycl::queue(gpu_selector{});
sycl::queue q_ct1 = sycl::queue(gpu_selector_v);
auto device = q_ct1.get_device();

int Cores = device.get_info<cl::sycl::info::device::max_compute_units>();
Expand All @@ -82,7 +82,7 @@ int adjustProblemSize(int GPU_N, int default_nOptions) {
}

int adjustGridSize(int GPUIndex, int defaultGridSize) {
sycl::queue q_ct1 = sycl::queue(gpu_selector{});
sycl::queue q_ct1 = sycl::queue(gpu_selector_v);
auto device = q_ct1.get_device();

int maxGridSize =
Expand Down Expand Up @@ -113,7 +113,7 @@ static CUT_THREADPROC solverThread(TOptionPlan *plan) {
// Allocate intermediate memory for MC integrator and initialize
// RNG states
sycl::queue stream = sycl::queue(
(sycl::platform(sycl::gpu_selector())
(sycl::platform(sycl::gpu_selector_v)
.get_devices(sycl::info::device_type::gpu)[plan->device]));

initMonteCarloGPU(plan, &stream);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#ifndef MONTECARLO_COMMON_H
#define MONTECARLO_COMMON_H
#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <oneapi/mkl.hpp>
#include <oneapi/mkl/rng/device.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <stdio.h>
#include <stdlib.h>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <oneapi/mkl.hpp>
#include <oneapi/mkl/rng/device.hpp>

Expand Down Expand Up @@ -105,7 +105,7 @@ extern "C" void MonteCarloCPU(TOptionValue &callValue, TOptionData optionData,
std::shared_ptr<oneapi::mkl::rng::philox4x32x10> gen;

gen = std::make_shared<oneapi::mkl::rng::philox4x32x10>(
sycl::queue(cpu_selector()), seed);
sycl::queue(cpu_selector_v), seed);
// unsigned long long seed = 1234ULL;

// checkCudaErrors(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <stdio.h>
#include <stdlib.h>

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>
#include <oneapi/mkl.hpp>
#include <oneapi/mkl/rng/device.hpp>

Expand Down Expand Up @@ -249,11 +249,9 @@ extern "C" void MonteCarloGPU(TOptionPlan *plan, sycl::queue *stream) {
plan->optionCount * sizeof(__TOptionData));

stream->submit([&](sycl::handler &cgh) {
sycl::accessor<real, 1, sycl::access_mode::read_write,
sycl::access::target::local>
sycl::local_accessor<real, 1>
s_SumCall_acc_ct1(sycl::range<1>(256 /*SUM_N*/), cgh);
sycl::accessor<real, 1, sycl::access_mode::read_write,
sycl::access::target::local>
sycl::local_accessor<real, 1>
s_Sum2Call_acc_ct1(sycl::range<1>(256 /*SUM_N*/), cgh);

auto plan_rngStates_ct0 = plan->rngStates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#ifndef MONTECARLO_REDUCTION_CUH
#define MONTECARLO_REDUCTION_CUH

#include <CL/sycl.hpp>
#include <sycl/sycl.hpp>

using namespace sycl;
#include "MonteCarlo_common.h"
Expand Down