- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to migrate CUDA sample https://github.com/NVIDIA/cuda-samples/tree/v11.5/Samples/SobelFilter using dpct. But got a lot of issues that some CUDA APIs not declared.
cudaGraphicsMapResources
cudaGraphicsResourceGetMappedPointer
cudaGraphicsUnmapResources
cudaGraphicsUnregisterResource
cudaGraphicsMapFlagsWriteDiscard
findCudaDevice
checkCudaErrors
And
SobelFilter/migration$ make
dpcpp -I../../common/inc -lGL -lGLU -lglut SobelFilter.cpp.dp.cpp SobelFilter_kernels.dp.cpp -o SobelFilter_dpcpp
SobelFilter_kernels.dp.cpp:96:40: error: use of undeclared identifier 'tex2D'
LocalBlock[SharedIdx+4*ib+1] = tex2D<unsigned char>(tex,
^
SobelFilter_kernels.dp.cpp:98:40: error: use of undeclared identifier 'tex2D'
LocalBlock[SharedIdx+4*ib+2] = tex2D<unsigned char>(tex,
...
My oneAPI version is 2021.4.
Does anyone know how to solve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First of all, according to our developers, cudaGraph* integration is not yet supported.
Second, the two errors you saw:
findCudaDevice
checkCudaErrors
are resulted from not including the correct header files while integrating.
1. copy necessary files to the workspace, my workspace folder is: ~/testfolder/cuda_test, you need to copy /usr/local/cuda/samples/common and SobelFilter in it like:
~/testfolder/cuda_test$ ls
common SobelFilter
2. change the SobelFilter/Makefile (since the location of folder common is changed)
change line 282 from:
280
281 # Common includes and paths for CUDA
282 INCLUDES := -I../../common/inc
283 LIBRARIES :=
284
to:
280
281 # Common includes and paths for CUDA
282 INCLUDES := -I../common/inc
283 LIBRARIES :=
284
3. generate compile_commands.json
~/testfolder/cuda_test$ cd SobelFilter/
~/testfolder/cuda_test/SobelFilter$ intercept-build make
4. use dpct to migrate
dpct -p . --in-root .. --out-root migration
5. cd into migration folder
~/testfolder/cudat_test/SobelFilter$ cd migration/
6. prepare Makefile
~/testfolder/cudat_test/SobelFilter/migration$ cat Makefile.dpct
CC := dpcpp
LD := $(CC)
#DPCT2001:40: You can link with more library by add them here.
LIB :=
FLAGS :=
TARGET_0_SRC_0 = ./SobelFilter/SobelFilter_kernels.dp.cpp
TARGET_0_OBJ_0 = ./SobelFilter/SobelFilter_kernels.dp.o
TARGET_0_FLAG_0 = -I./common/inc ${FLAGS}
TARGET_0_SRC_1 = ./SobelFilter/SobelFilter.cpp.dp.cpp
TARGET_0_OBJ_1 = ./SobelFilter/SobelFilter.cpp.dp.o
TARGET_0_FLAG_1 = -I./common/inc ${FLAGS}
TARGET_0 := SobelFilter
TARGET := ${TARGET_0}
.PHONY:all clean
OBJS_0 := ${TARGET_0_OBJ_0} ${TARGET_0_OBJ_1}
all: $(TARGET)
$(TARGET_0): $(OBJS_0)
$(LD) -o $@ $^ $(LIB)
$(TARGET_0_OBJ_0):$(TARGET_0_SRC_0)
$(CC) -c ${TARGET_0_SRC_0} -o ${TARGET_0_OBJ_0} $(TARGET_0_FLAG_0)
$(TARGET_0_OBJ_1):$(TARGET_0_SRC_1)
$(CC) -c ${TARGET_0_SRC_1} -o ${TARGET_0_OBJ_1} $(TARGET_0_FLAG_1)
clean:
rm -f ${OBJS_0} $(TARGET)
7. build with dpcpp
make -f Makefile.dpct
To be more specific, the two errors about findCudaDevice and checkCudaErrors occurred because you needed the files in /usr/local/cuda/samples/common; you had to put them in the same directory with your source files so they could be integrated together.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
We are able to reproduce your issue at our end using the latest oneAPI 2021.4 on a ubuntu 18.04 machine. we are working on your issue internally and will get back to you soon.
Thanks & Regards,
Hemanth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm working on it and will get back to you as soon as I have any update.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please clarify for me--
- "got a lot of issues that some CUDA APIs not declared"--can you tell me what those are?
- From which file are you seeing the errors?
- What are you reproducing steps?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's my steps:
System Ubuntu 20.04.3
1. Setup Intel® oneAPI Base Toolkit https://www.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top/installation/install-using-package-managers/apt.html
2. Download and install CUDA tookit. https://developer.nvidia.com/cuda-11.1.1-download-archive
3. Navigate the SobelFilter code in Cuda sample installed into system.
# cd /usr/local/cuda-11.1/samples/3_Imaging/SobelFilter/
Run
# intercept-build make
# dpct -p compile_commands.json --in-root=. --out-root=migration
Fixed the warning with DPCT1049, DPCT1050 following the instruction in Diagnostic Reference .
.
Next to enter migrate folder, and copy the following contents as my Makefile in current dir.
# cd migrate/
CXX = dpcpp TARGET = SobelFilter_dpcpp SRCS = SobelFilter.cpp.dp.cpp DEPS = SobelFilter_kernels.dp.cpp INCS := -I../../../common/inc
all: $(TARGET)
$(TARGET): $(SRCS) $(DEPS) $(CXX) $(INCS) $(SRCS) $(DEPS) -o $@
run: $(TARGET) ./$(TARGET)
.PHONY: clean clean: rm -f $(TARGET) *.o result.txt |
Active the oneAPI and then run make command:
# source /opt/intel/oneapi/setvars.sh
# make
Here is my screenshot:
This make message appears all errors in SobelFilter.cpp.dp.cpp. And the incomptiable APIs include:
cudaGraphicsMapResources
cudaGraphicsResourceGetMappedPointer
cudaGraphicsUnmapResources
cudaGraphicsUnregisterResource
cudaGraphicsMapFlagsWriteDiscard
findCudaDevice
checkCudaErrors
and in migration/SobelFilter_kernels.dp.cpp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your issue has been escalated to the developers. We'll work on it internally and get back to you with update.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First of all, according to our developers, cudaGraph* integration is not yet supported.
Second, the two errors you saw:
findCudaDevice
checkCudaErrors
are resulted from not including the correct header files while integrating.
1. copy necessary files to the workspace, my workspace folder is: ~/testfolder/cuda_test, you need to copy /usr/local/cuda/samples/common and SobelFilter in it like:
~/testfolder/cuda_test$ ls
common SobelFilter
2. change the SobelFilter/Makefile (since the location of folder common is changed)
change line 282 from:
280
281 # Common includes and paths for CUDA
282 INCLUDES := -I../../common/inc
283 LIBRARIES :=
284
to:
280
281 # Common includes and paths for CUDA
282 INCLUDES := -I../common/inc
283 LIBRARIES :=
284
3. generate compile_commands.json
~/testfolder/cuda_test$ cd SobelFilter/
~/testfolder/cuda_test/SobelFilter$ intercept-build make
4. use dpct to migrate
dpct -p . --in-root .. --out-root migration
5. cd into migration folder
~/testfolder/cudat_test/SobelFilter$ cd migration/
6. prepare Makefile
~/testfolder/cudat_test/SobelFilter/migration$ cat Makefile.dpct
CC := dpcpp
LD := $(CC)
#DPCT2001:40: You can link with more library by add them here.
LIB :=
FLAGS :=
TARGET_0_SRC_0 = ./SobelFilter/SobelFilter_kernels.dp.cpp
TARGET_0_OBJ_0 = ./SobelFilter/SobelFilter_kernels.dp.o
TARGET_0_FLAG_0 = -I./common/inc ${FLAGS}
TARGET_0_SRC_1 = ./SobelFilter/SobelFilter.cpp.dp.cpp
TARGET_0_OBJ_1 = ./SobelFilter/SobelFilter.cpp.dp.o
TARGET_0_FLAG_1 = -I./common/inc ${FLAGS}
TARGET_0 := SobelFilter
TARGET := ${TARGET_0}
.PHONY:all clean
OBJS_0 := ${TARGET_0_OBJ_0} ${TARGET_0_OBJ_1}
all: $(TARGET)
$(TARGET_0): $(OBJS_0)
$(LD) -o $@ $^ $(LIB)
$(TARGET_0_OBJ_0):$(TARGET_0_SRC_0)
$(CC) -c ${TARGET_0_SRC_0} -o ${TARGET_0_OBJ_0} $(TARGET_0_FLAG_0)
$(TARGET_0_OBJ_1):$(TARGET_0_SRC_1)
$(CC) -c ${TARGET_0_SRC_1} -o ${TARGET_0_OBJ_1} $(TARGET_0_FLAG_1)
clean:
rm -f ${OBJS_0} $(TARGET)
7. build with dpcpp
make -f Makefile.dpct
To be more specific, the two errors about findCudaDevice and checkCudaErrors occurred because you needed the files in /usr/local/cuda/samples/common; you had to put them in the same directory with your source files so they could be integrated together.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page