This forum has been archived. All content is frozen. Please use KDE Discuss instead.

CUDA development in KDevelop 5.4

Tags: None
(comma "," separated)
pjk
Registered Member
Posts
1
Karma
0

CUDA development in KDevelop 5.4

Wed Nov 27, 2019 9:00 am
Hi there!
I am looking for a tool more suitable than Nvidia Nsight to develop code of a large project in C++14/CUDA on Linux. Nsight is built on top of Eclipse, has many limitations, poor C++ parser, poor cmake support, etc. C++14 breaks Nsight almost completely and I was forced to resort to using tools like vim.

KDevelop's "Features" page claims support for CUDA:
The following languages are fully supported, which means they have semantic syntax highlighting, code navigation and completion:
C/C++ and ObjC (backed by the Clang/LLVM libraries)
    Including some extra features for the Qt Framework
    Including language support for CUDA and OpenCL


I have a tiny project here:
CMakeLists.txt
Code: Select all
cmake_minimum_required(VERSION 3.9)

project(cuda-test LANGUAGES CXX CUDA)

find_package(CUDA)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CUDA_STANDARD 14)

add_subdirectory(service)


service/CMakeLists.txt
Code: Select all
find_package(CUDA)
include_directories(${CUDA_INCLUDE_DIRS} .)

add_executable(service main.cu TestClass.cu)


service/TestClass.cuh
Code: Select all
#pragma once
class TestClass
{
public:
  TestClass(float2 fl2, cudaStream_t& cudaStream, std::vector<float2>&& v);
 
private:
  float2 m_fl2;
  cudaStream_t m_stream;
  std::vector<float2> m_v;
  std::shared_ptr<std::function<void()>> m_nonInterestingFunction;
};


service/TestClass.cu
Code: Select all
#include "TestClass.cuh"

TestClass::TestClass(float2 fl2, cudaStream_t& cudaStream, std::vector<float2>&& v)
  : m_fl2{fl2},
    m_stream{cudaStream},
    m_v{std::move(v)}
{
  m_nonInterestingFunction = std::make_shared<std::function<void()>>();
}


service/main.cu
Code: Select all
#include <iostream>
#include "TestClass.cuh"

int main(int argc, char* argv[])
{
  cudaStream_t stream = nullptr;
  std::vector<float2> v;
  TestClass tc{{1.f, 1.f}, stream, std::move(v)};
  return 0;
}


cuda-test.kdev4
Code: Select all
[Project]
CreatedFrom=CMakeLists.txt
Manager=KDevCMakeManager
Name=cuda-test


Project compiles fine with both clang and g++-8.
KDevelop 5.4.4, however, seems to be unable to parse C++ code in *.cu or *.cuh files: https://imgur.com/a/Sln1zYx
My question is: to what extent is CUDA supported in KDevelop, then?


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell