Migrating to SYCL
One-stop forum for getting assistance migrating your existing code to SYCL
46 Discussions

Why isn't DPCT detecting any CUDA code?

Mark_Lewy
Valued Contributor I
200 Views

I'm attempting to follow the workflow for migrating our CUDA code with dpct, but it doesn't recognise our code as CUDA, the last message from dpct is "dpct exited with code: 1 (Migration not necessary; no CUDA code detected.)"

Environment:

Ubuntu 22.04.5 LTS on WSL

OneAPI 2025.1

cmake 3.31.7

I have attached the commands and output.  I also tried doing this from a VS 2022 project in Windows with similar results.  If you look at the output, there is definitely some CUDA being built!

The addWithCuda sample code migrates fine.

The code is commercial, so can't be shared here.

The only thing I can think of is that we put most of the source code in include (.h) files, so this isn't being parsed by dpct?

Suggestions welcome (I do have an Intel Priority Support account, so could submit a case, if needed)

The idiom we use is in these extracts

iw2d_CUDA.cu:

#define WIN32_LEAN_AND_MEAN

// includes, system
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <cuda_runtime_api.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include "cuda.h"
#include <thrust/host_vector.h>
#include <thrust/device_vector.h>
#include <thrust/copy.h>
#include <thrust/fill.h>
#include <thrust/sequence.h>
#include <thrust/replace.h>
#include <thrust/transform.h>
#include <thrust/functional.h>


// includes, project
#include <cutil_inline.h>

// includes, kernels
#include "../iw2d_CUDA_single_prec/iw2d_CUDA_single_prec.h"
#include "../iw2d_CUDA_double_prec/iw2d_CUDA_double_prec.h"

// Elided: time functions and API wrappers

iw2d_single_prec.h:

#ifdef _IW2D_CUDA_SINGLE_PREC

#ifndef __IW2D_CUDA_SINGLE_PREC_H_
#define __IW2D_CUDA_SINGLE_PREC_H_

#include "../iw2d_CUDA/iw2d_CUDA.h"
#include "../iw2d_CUDA/iw2d_CUDA_kernel.cu"
#include "../iw2d_CUDA/iw2d_CUDA_kernel_WQ.cu"
#include "../iw2d_CUDA/iw2d_CUDA_kernel_results.cu"
#include "../iw2d_CUDA/iw2d_CUDA_error.cu"
#include "../iw2d_CUDA/iw2d_CUDA_initialization.cu"
#include "../iw2d_CUDA/iw2d_CUDA_initialization_UM.cu"
#include "../iw2d_CUDA/iw2d_CUDA_timestep.cu"
#include "../iw2d_CUDA/iw2d_CUDA_timestep_UM.cu"
#include "../iw2d_CUDA/iw2d_CUDA_run.cu"
#include "../iw2d_CUDA/iw2d_CUDA_run_UM.cu"
#include "../iw2d_CUDA/iw2d_CUDA_finalise.cu"
#include "../iw2d_CUDA/iw2d_CUDA_finalise_UM.cu"
#include "../iw2d_CUDA/iw2d_CUDA_clean_up.cu"
#include "../iw2d_CUDA/iw2d_CUDA_util.cu"

#endif //__IW2D_CUDA_SINGLE_PREC_H_

#endif

 

0 Kudos
1 Solution
Mark_Lewy
Valued Contributor I
151 Views

I think I understand what is happening here - the source file is not in the same folder as the cmake build system, so I either have to use --in-root or run dpct in the folder that contains the source.  The VS project suffers from the same issue.

View solution in original post

0 Kudos
2 Replies
Mark_Lewy
Valued Contributor I
152 Views

I tried manually inlining all of the source files into a single file - no change.  The single source file contains about 32000 lines, too large?

0 Kudos
Mark_Lewy
Valued Contributor I
152 Views

I think I understand what is happening here - the source file is not in the same folder as the cmake build system, so I either have to use --in-root or run dpct in the folder that contains the source.  The VS project suffers from the same issue.

0 Kudos
Reply