Skip to content

[bug] how to solve compile sycl-toolchain code occur error: '/tmp/libsycl-fallback-imf-d878ec.cubin': Permission denied #7777

Closed
@wangzy0327

Description

@wangzy0327

Describe the bug

sometimes occur the following error. how to solve it ?
clang-16: warning: linked binaries do not contain expected 'nvptx64-nvidia-cuda' target; found targets: 'nvptx64-nvidia-cuda-sm_50' [-Wsycl-target]
/home/wzy/sycl_workspace/build-cuda-2022-09-debug/bin/clang-offload-bundler: error: '/tmp/libsycl-fallback-imf-d878ec.cubin': Permission denied
clang-16: error: clang-offload-bundler command failed with exit code 1 (use -v to see invocation)
CMakeFiles/hello-sycl.dir/build.make:102: recipe for target 'hello-sycl' failed
gmake[2]: *** [hello-sycl] Error 1
CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/hello-sycl.dir/all' failed
gmake[1]: *** [CMakeFiles/hello-sycl.dir/all] Error 2

To Reproduce

any sycl-example code occurs the error somtimes.

There provides a sycl example that occurs the following error when the code compile(cmake -B build && cmake --build build).

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.12)

set(CMAKE_C_COMPILER "/home/wzy/sycl_workspace/build-cuda-2022-09-debug/bin/clang")
set(CMAKE_CXX_COMPILER "/home/wzy/sycl_workspace/build-cuda-2022-09-debug/bin/clang++")
set(CMAKE_CXX_STANDARD 17)

project(hello-sycl)

set(DPCPP_HOME "/home/wzy/sycl_workspace")
set(DPCPP_SYCL_HOME "${DPCPP_HOME}/build-cuda-2022-09-debug")

include_directories("${DPCPP_SYCL_HOME}/include/sycl")
include_directories("${DPCPP_SYCL_HOME}/include")

message(STATUS "dpcpp_home : ${DPCPP_HOME}")
message(STATUS "dpcpp_cuda_sycl_home : ${DPCPP_SYCL_HOME}")

message(STATUS "find library path : ${DPCPP_SYCL_HOME}/lib")
set(CMAKE_BUILD_RPATH "${DPCPP_SYCL_HOME}/lib;${CMAKE_BUILD_RPATH}")
message(STATUS "cmake build rpath : ${CMAKE_BUILD_RPATH}")

set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS "-fsycl -fsycl-targets=nvptx64-nvidia-cuda")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb -std=c++17 -Wno-sycl-target -Wno-linker-warnings")

set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -std=c++17")

link_directories("${DPCPP_SYCL_HOME}/lib")

aux_source_directory(. DIR_SRCS)
add_executable(hello-sycl ${DIR_SRCS})
target_include_directories(hello-sycl PRIVATE "${DPCPP_SYCL_HOME}/include/sycl")
target_include_directories(hello-sycl PRIVATE "${DPCPP_SYCL_HOME}/include")
target_link_libraries(hello-sycl PRIVATE sycl)

my-example
#include <sycl/sycl.hpp>
#include <iostream>
#include <vector>
using namespace sycl;

int main(){
    std::cout<<"hello sycl"<<std::endl;
    const int N = 4;
    const int MAGIC_NUM = 42;
    std::vector<int> vec_num = {3,4,5,6,7,8,9};
    std::cout<<vec_num[0]<<std::endl;

    queue q;
    auto dev = q.get_device();
    std::cout<<"default queue select device info : "<<&dev<<std::endl;
    std::cout<<"default queue select device vendor id : "<<dev.get_info<sycl::info::device::vendor_id>()<<std::endl;
    std::cout<<"default queue select device vendor name : "<<dev.get_info<sycl::info::device::name>()<<std::endl;
    auto devices = dev.get_devices();
    for (auto &device : devices) {
            std::cout << "  queue get device: " << device.get_info<sycl::info::device::name>() << std::endl;
            std::cout << "  queue get device vendor id: " << device.get_info<sycl::info::device::vendor_id>()<< std::endl;
            std::cout << "  queue get device object address : " << &device << std::endl;                    
    }
    auto ctxt = q.get_context();
 
    auto platforms = sycl::platform::get_platforms();
    for (auto &platform : platforms) {
        std::cout << "Platform name : " << platform.get_info<sycl::info::platform::name>()<< std::endl;
        std::cout << "Platform profile : " << platform.get_info<sycl::info::platform::profile>()<<std::endl;
        std::cout << "Platform version : " << platform.get_info<sycl::info::platform::version>()<<std::endl;
        std::cout << "Platform vendor : " << platform.get_info<sycl::info::platform::vendor>()<<std::endl;
        std::cout << "Platform object address : " << &platform<< std::endl;            
        
        auto devices = platform.get_devices();
        for (auto &device : devices) {
            std::cout << "  Device: " << device.get_info<sycl::info::device::name>() << std::endl;
            std::cout << "  Device vendor id: " << device.get_info<sycl::info::device::vendor_id>()<< std::endl;
            std::cout << "  Device object address : " << &device << std::endl;                    
        }
    }

    std::vector<kernel_id> builtinKernelIds =
        dev.get_info<info::device::built_in_kernel_ids>();

    std::cout<<"built in kernel size : "<<builtinKernelIds.size()<<std::endl;

    auto myBundle = get_kernel_bundle<bundle_state::executable>(ctxt);

    return 0;
}

5d37226067800cd88bd94e37328e8aa

b36a926defda18cba8d2765d7894e15

Environment (please complete the following information):

  • OS: [Ubuntu 18.04]
  • Target device and vendor: [Nvidia GPU]
  • DPC++ version: sycl-2022-09
  • Dependencies version: [cuda 11.2]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcudaCUDA back-endinvalidThis doesn't seem right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions