MuGdxy / muda

μ-Cuda, COVER THE LAST MILE OF CUDA. With features: intellisense-friendly, structured launch, automatic cuda graph generation and updating.
https://mugdxy.github.io/muda-doc/
Apache License 2.0
144 stars 7 forks source link

Problem: Compilation errors #54

Closed Da1sypetals closed 1 month ago

Da1sypetals commented 1 month ago

From muda-app code, changing hello_muda.h to the following causes thousands of lines of compilation error.

hello_muda.h:

#pragma once
#include <muda/muda.h>

namespace md = muda;

void hello_muda();

class Cloth{
    md::HostVector<float> hx;

};

terminal output: output.txt first few lines:

In file included from /mnt/a/dev/muda/muda-app/submodules/muda/src/muda/tools/debug_log.h:4,
                 from /mnt/a/dev/muda/muda-app/submodules/muda/src/muda/check/check.h:7,
                 from /mnt/a/dev/muda/muda-app/submodules/muda/src/muda/check/check_cuda_errors.h:2,
                 from /mnt/a/dev/muda/muda-app/submodules/muda/src/muda/launch/stream.h:6,
                 from /mnt/a/dev/muda/muda-app/submodules/muda/src/muda/launch.h:2,
                 from /mnt/a/dev/muda/muda-app/submodules/muda/src/muda/muda.h:3,
                 from /mnt/a/dev/muda/muda-app/src/hello_muda.h:3,
                 from /mnt/a/dev/muda/muda-app/src/main.cpp:1:
/mnt/a/dev/muda/muda-app/submodules/muda/src/muda/tools/fuzzy.h: In function ‘decltype(auto) muda::invoke(FHost&&, FDevice&&)’:
/mnt/a/dev/muda/muda-app/submodules/muda/src/muda/tools/fuzzy.h:12:23: error: ‘is_same_v’ is not a member of ‘std’
   12 |     if constexpr(std::is_same_v<std::invoke_result_t<FHost>, void>
      |                       ^~~~~~~~~
/mnt/a/dev/muda/muda-app/submodules/muda/src/muda/tools/fuzzy.h:12:38: error: ‘invoke_result_t’ is not a member of ‘std’
   12 |     if constexpr(std::is_same_v<std::invoke_result_t<FHost>, void>
      |                                      ^~~~~~~~~~~~~~~
/mnt/a/dev/muda/muda-app/submodules/muda/src/muda/tools/fuzzy.h:1:1: note: ‘std::invoke_result_t’ is defined in header ‘<type_traits>’; did you forget to ‘#include <type_traits>’?
  +++ |+#include <type_traits>
    1 | #pragma once
/mnt/a/dev/muda/muda-app/submodules/muda/src/muda/tools/fuzzy.h:12:59: error: expected primary-expression before ‘>’ token
   12 |     if constexpr(std::is_same_v<std::invoke_result_t<FHost>, void>
      |                                                           ^
/mnt/a/dev/muda/muda-app/submodules/muda/src/muda/tools/fuzzy.h:12:60: error: expected primary-expression before ‘,’ token
   12 |     if constexpr(std::is_same_v<std::invoke_result_t<FHost>, void>
      |                                                            ^

I believe this is some configuration mistake but I just cannot figure it out. Thanks a lot in advance.

MuGdxy commented 1 month ago

You should not expose any cuda-related code to a normal cpp source. So, anything about muda should not be included in a .cpp file. It May be the time to learn from https://github.com/phys-sim-book/solid-sim-tutorial-gpu, how to hide the backend implementation from the normal host cpp program.

Da1sypetals commented 1 month ago

Get it. It is just the error message is too unrelated to cuda :sob: I will learn from the repo, thanks!