Skip to content

Commit 471ba90

Browse files
authored
Merge pull request #1813 from ManjulaChalla/montecarlo_b
Revisited MonteCarloMultiGPU SYCL Migration with 01_dpct_output folder modification
2 parents 8178099 + ddd7083 commit 471ba90

File tree

12 files changed

+1223
-824
lines changed

12 files changed

+1223
-824
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl")
2+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
3+
SET(CMAKE_EXE_LINKER_FLAGS "-pthread ${CMAKE_EXE_LINKER_FLAGS}")
4+
SET(CMAKE_EXE_LINKER_FLAGS "-qmkl ${CMAKE_EXE_LINKER_FLAGS}")
5+
include_directories(${CMAKE_SOURCE_DIR}/01_dpct_output/Common/)
6+
include_directories(${CMAKE_SOURCE_DIR}/01_dpct_output/include/)
7+
8+
add_executable (01_dpct_output Samples/5_Domain_Specific/MonteCarloMultiGPU/MonteCarloMultiGPU.cpp.dp.cpp Samples/5_Domain_Specific/MonteCarloMultiGPU/MonteCarlo_gold.cpp.dp.cpp Samples/5_Domain_Specific/MonteCarloMultiGPU/MonteCarlo_kernel.dp.cpp Samples/5_Domain_Specific/MonteCarloMultiGPU/multithreading.cpp)
9+
target_link_libraries(01_dpct_output sycl)
10+
11+
add_custom_target (run_cpu cd ${CMAKE_SOURCE_DIR}/01_dpct_output/ && SYCL_DEVICE_FILTER=cpu ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/01_dpct_output)
12+
add_custom_target (run_gpu cd ${CMAKE_SOURCE_DIR}/01_dpct_output/ && SYCL_DEVICE_FILTER=level_zero:gpu ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/01_dpct_output)
13+
add_custom_target (run_gpu_opencl cd ${CMAKE_SOURCE_DIR}/01_dpct_output/ && SYCL_DEVICE_FILTER=opencl:gpu ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/01_dpct_output)

DirectProgramming/C++SYCL/MapReduce/guided_MonteCarloMultiGPU_SYCLMigration/01_dpct_output/Common/helper_cuda.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#ifdef __DPCT_HPP__
5555
static const char *_cudaGetErrorEnum(dpct::err0 error) {
5656
/*
57-
DPCT1009:5: SYCL uses exceptions to report errors and does not use the error
57+
DPCT1009:4: SYCL uses exceptions to report errors and does not use the error
5858
codes. The original code was commented out and a warning string was inserted.
5959
You need to rewrite this code.
6060
*/
@@ -602,7 +602,7 @@ void check(T result, char const *const func, const char *const file,
602602
inline void __getLastCudaError(const char *errorMessage, const char *file,
603603
const int line) {
604604
/*
605-
DPCT1010:6: SYCL uses exceptions to report errors and does not use the error
605+
DPCT1010:5: SYCL uses exceptions to report errors and does not use the error
606606
codes. The call was replaced with 0. You need to rewrite this code.
607607
*/
608608
dpct::err0 err = 0;
@@ -615,7 +615,7 @@ inline void __getLastCudaError(const char *errorMessage, const char *file,
615615
inline void __printLastCudaError(const char *errorMessage, const char *file,
616616
const int line) {
617617
/*
618-
DPCT1010:8: SYCL uses exceptions to report errors and does not use the error
618+
DPCT1010:7: SYCL uses exceptions to report errors and does not use the error
619619
codes. The call was replaced with 0. You need to rewrite this code.
620620
*/
621621
dpct::err0 err = 0;
@@ -636,7 +636,7 @@ inline int ftoi(float value) {
636636
inline int _ConvertSMVer2Cores(int major, int minor) {
637637
// Defines for GPU Architecture types (using the SM version to determine
638638
// the # of cores per SM
639-
typedef struct dpct_type_148198 {
639+
typedef struct dpct_type_146989 {
640640
int SM; // 0xMm (hexidecimal notation), M = SM Major version,
641641
// and m = SM minor version
642642
int Cores;
@@ -685,7 +685,7 @@ inline int _ConvertSMVer2Cores(int major, int minor) {
685685
inline const char* _ConvertSMVer2ArchName(int major, int minor) {
686686
// Defines for GPU Architecture types (using the SM version to determine
687687
// the GPU Arch name)
688-
typedef struct dpct_type_135042 {
688+
typedef struct dpct_type_101439 {
689689
int SM; // 0xMm (hexidecimal notation), M = SM Major version,
690690
// and m = SM minor version
691691
const char* name;
@@ -737,7 +737,7 @@ inline const char* _ConvertSMVer2ArchName(int major, int minor) {
737737
inline int gpuDeviceInit(int devID) {
738738
int device_count;
739739
/*
740-
DPCT1003:10: Migrated API does not return error code. (*, 0) is inserted. You
740+
DPCT1003:9: Migrated API does not return error code. (*, 0) is inserted. You
741741
may need to rewrite this code.
742742
*/
743743
checkCudaErrors((device_count = dpct::dev_mgr::instance().device_count(), 0));
@@ -767,7 +767,7 @@ inline int gpuDeviceInit(int devID) {
767767

768768
int computeMode = -1, major = 0, minor = 0;
769769
/*
770-
DPCT1035:11: All SYCL devices can be used by the host to submit tasks. You may
770+
DPCT1035:10: All SYCL devices can be used by the host to submit tasks. You may
771771
need to adjust this code.
772772
*/
773773
checkCudaErrors((computeMode = 1, 0));
@@ -778,7 +778,7 @@ inline int gpuDeviceInit(int devID) {
778778
(minor = dpct::dev_mgr::instance().get_device(devID).get_minor_version(),
779779
0));
780780
/*
781-
DPCT1035:12: All SYCL devices can be used by the host to submit tasks. You may
781+
DPCT1035:11: All SYCL devices can be used by the host to submit tasks. You may
782782
need to adjust this code.
783783
*/
784784
if (computeMode == 0) {
@@ -794,11 +794,11 @@ inline int gpuDeviceInit(int devID) {
794794
}
795795

796796
/*
797-
DPCT1093:13: The "devID" device may be not the one intended for use. Adjust
797+
DPCT1093:12: The "devID" device may be not the one intended for use. Adjust
798798
the selected device if needed.
799799
*/
800800
/*
801-
DPCT1003:14: Migrated API does not return error code. (*, 0) is inserted. You
801+
DPCT1003:13: Migrated API does not return error code. (*, 0) is inserted. You
802802
may need to rewrite this code.
803803
*/
804804
checkCudaErrors((dpct::select_device(devID), 0));
@@ -816,7 +816,7 @@ inline int gpuGetMaxGflopsDeviceId() try {
816816

817817
uint64_t max_compute_perf = 0;
818818
/*
819-
DPCT1003:15: Migrated API does not return error code. (*, 0) is inserted. You
819+
DPCT1003:14: Migrated API does not return error code. (*, 0) is inserted. You
820820
may need to rewrite this code.
821821
*/
822822
checkCudaErrors((device_count = dpct::dev_mgr::instance().device_count(), 0));
@@ -834,7 +834,7 @@ inline int gpuGetMaxGflopsDeviceId() try {
834834
while (current_device < device_count) {
835835
int computeMode = -1, major = 0, minor = 0;
836836
/*
837-
DPCT1035:16: All SYCL devices can be used by the host to submit tasks. You
837+
DPCT1035:15: All SYCL devices can be used by the host to submit tasks. You
838838
may need to adjust this code.
839839
*/
840840
checkCudaErrors((computeMode = 1, 0));
@@ -850,7 +850,7 @@ inline int gpuGetMaxGflopsDeviceId() try {
850850
// If this GPU is not running on Compute Mode prohibited,
851851
// then we can add it to the list
852852
/*
853-
DPCT1035:17: All SYCL devices can be used by the host to submit tasks. You
853+
DPCT1035:16: All SYCL devices can be used by the host to submit tasks. You
854854
may need to adjust this code.
855855
*/
856856
if (computeMode != 0) {
@@ -921,11 +921,11 @@ inline int findCudaDevice(int argc, const char **argv) {
921921
// Otherwise pick the device with highest Gflops/s
922922
devID = gpuGetMaxGflopsDeviceId();
923923
/*
924-
DPCT1093:18: The "devID" device may be not the one intended for use. Adjust
924+
DPCT1093:17: The "devID" device may be not the one intended for use. Adjust
925925
the selected device if needed.
926926
*/
927927
/*
928-
DPCT1003:19: Migrated API does not return error code. (*, 0) is inserted.
928+
DPCT1003:18: Migrated API does not return error code. (*, 0) is inserted.
929929
You may need to rewrite this code.
930930
*/
931931
checkCudaErrors((dpct::select_device(devID), 0));
@@ -950,7 +950,7 @@ inline int findIntegratedGPU() {
950950
int devices_prohibited = 0;
951951

952952
/*
953-
DPCT1003:20: Migrated API does not return error code. (*, 0) is inserted. You
953+
DPCT1003:19: Migrated API does not return error code. (*, 0) is inserted. You
954954
may need to rewrite this code.
955955
*/
956956
checkCudaErrors((device_count = dpct::dev_mgr::instance().device_count(), 0));
@@ -964,7 +964,7 @@ inline int findIntegratedGPU() {
964964
while (current_device < device_count) {
965965
int computeMode = -1, integrated = -1;
966966
/*
967-
DPCT1035:21: All SYCL devices can be used by the host to submit tasks. You
967+
DPCT1035:20: All SYCL devices can be used by the host to submit tasks. You
968968
may need to adjust this code.
969969
*/
970970
checkCudaErrors((computeMode = 1, 0));
@@ -975,16 +975,16 @@ inline int findIntegratedGPU() {
975975
// If GPU is integrated and is not running on Compute Mode prohibited,
976976
// then cuda can map to GLES resource
977977
/*
978-
DPCT1035:22: All SYCL devices can be used by the host to submit tasks. You
978+
DPCT1035:21: All SYCL devices can be used by the host to submit tasks. You
979979
may need to adjust this code.
980980
*/
981981
if (integrated && (computeMode != 0)) {
982982
/*
983-
DPCT1093:23: The "current_device" device may be not the one intended for
983+
DPCT1093:22: The "current_device" device may be not the one intended for
984984
use. Adjust the selected device if needed.
985985
*/
986986
/*
987-
DPCT1003:24: Migrated API does not return error code. (*, 0) is inserted.
987+
DPCT1003:23: Migrated API does not return error code. (*, 0) is inserted.
988988
You may need to rewrite this code.
989989
*/
990990
checkCudaErrors((dpct::select_device(current_device), 0));

0 commit comments

Comments
 (0)