Commit 698a442e authored by Jehandad Khan's avatar Jehandad Khan
Browse files

Cleanup CMakeLists and correct function name

parent c8dca79f
cmake_minimum_required(VERSION 3.15) cmake_minimum_required(VERSION 3.15)
project(ck_app) project(ck_app)
add_compile_options(-std=c++14) add_compile_options(-std=c++14)
# add_link_options(--offload-arch=gfx908)
#set(CMAKE_CXX_STANDARD 14)
#set(CMAKE_CXX_STANDARD_REQUIRED True)
find_package(composable_kernel 1.0.0 COMPONENTS device_operations host_tensor) find_package(composable_kernel 1.0.0 COMPONENTS device_operations host_tensor)
find_package(hip REQUIRED PATHS /opt/rocm) find_package(hip REQUIRED PATHS /opt/rocm)
message(STATUS "Build with HIP ${hip_VERSION}") message(STATUS "Build with HIP ${hip_VERSION}")
# target_flags(HIP_COMPILER_FLAGS hip::device)
# Remove cuda arch flags
#string(REGEX REPLACE --cuda-gpu-arch=[a-z0-9]+ "" HIP_COMPILER_FLAGS "${HIP_COMPILER_FLAGS}")
#string(REGEX REPLACE --offload-arch=[a-z0-9]+ "" HIP_COMPILER_FLAGS "${HIP_COMPILER_FLAGS}")
#string(REPLACE "$<LINK_LANGUAGE:CXX>" "1" HIP_COMPILER_FLAGS "${HIP_COMPILER_FLAGS}")
#string(REPLACE "SHELL:" "" HIP_COMPILER_FLAGS "${HIP_COMPILER_FLAGS}")
add_executable(myexe client_app.cpp) add_executable(myexe client_app.cpp)
target_link_libraries(myexe PRIVATE composable_kernel::device_operations composable_kernel::host_tensor hip::host) target_link_libraries(myexe PRIVATE composable_kernel::device_operations composable_kernel::host_tensor hip::host)
#
...@@ -28,8 +28,7 @@ enum ConvOutputLayout ...@@ -28,8 +28,7 @@ enum ConvOutputLayout
NHWK, // 1 NHWK, // 1
}; };
// Code to check CUDA errors void check_hip_error(void)
void check_cuda_error(void)
{ {
hipError_t err = hipGetLastError(); hipError_t err = hipGetLastError();
if(err != hipSuccess) if(err != hipSuccess)
...@@ -42,7 +41,7 @@ std::string getDeviceName(int device) ...@@ -42,7 +41,7 @@ std::string getDeviceName(int device)
{ {
struct hipDeviceProp_t prop; struct hipDeviceProp_t prop;
hipGetDeviceProperties(&prop, device); hipGetDeviceProperties(&prop, device);
check_cuda_error(); check_hip_error();
return std::string(prop.name); return std::string(prop.name);
} }
...@@ -50,7 +49,7 @@ int getDriver(void) ...@@ -50,7 +49,7 @@ int getDriver(void)
{ {
int driver; int driver;
hipDriverGetVersion(&driver); hipDriverGetVersion(&driver);
check_cuda_error(); check_hip_error();
return driver; return driver;
} }
...@@ -153,11 +152,11 @@ void profile_conv_fwd_impl(int do_verification, ...@@ -153,11 +152,11 @@ void profile_conv_fwd_impl(int do_verification,
float best_gb_per_sec = 0; float best_gb_per_sec = 0;
int deviceIndex = 0; int deviceIndex = 0;
hipSetDevice(deviceIndex); hipSetDevice(deviceIndex);
check_cuda_error(); check_hip_error();
hipStream_t stream_id = nullptr; hipStream_t stream_id = nullptr;
hipStreamCreate(&stream_id); hipStreamCreate(&stream_id);
check_cuda_error(); check_hip_error();
// profile device Conv instances // profile device Conv instances
for(auto& conv_ptr : conv_ptrs) for(auto& conv_ptr : conv_ptrs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment