• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daisytuner / docc / 22994637400

12 Mar 2026 09:13AM UTC coverage: 63.488% (-1.1%) from 64.629%
22994637400

Pull #570

github

web-flow
Merge 4acc9e80f into 607827514
Pull Request #570: Added ET target tests to github CI

24709 of 38919 relevant lines covered (63.49%)

369.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

38.24
/opt/src/targets/cuda/cuda.cpp
1
#include "sdfg/targets/cuda/cuda.h"
2

3
#include <cstdlib>
4
#include <sdfg/codegen/dispatchers/sequence_dispatcher.h>
5
#include <string>
6

7
namespace sdfg {
8
namespace cuda {
9

10
void cuda_error_checking(
11
    codegen::PrettyPrinter& stream,
12
    const codegen::LanguageExtension& language_extension,
13
    const std::string& status_variable
14
) {
4✔
15
    if (!do_cuda_error_checking()) {
4✔
16
        return;
4✔
17
    }
4✔
18
    stream << "if (" << status_variable << " != cudaSuccess) {" << std::endl;
×
19
    stream.setIndent(stream.indent() + 4);
×
20
    stream << language_extension.external_prefix()
×
21
           << "fprintf(stderr, \"CUDA error: %s File: %s, Line: %d\\n\", cudaGetErrorString(" << status_variable
×
22
           << "), __FILE__, __LINE__);" << std::endl;
×
23
    stream << language_extension.external_prefix() << "exit(EXIT_FAILURE);" << std::endl;
×
24
    stream.setIndent(stream.indent() - 4);
×
25
    stream << "}" << std::endl;
×
26
}
×
27

28
bool do_cuda_error_checking() {
8✔
29
    auto env = getenv("DOCC_CUDA_DEBUG");
8✔
30
    if (env == nullptr) {
8✔
31
        return false;
8✔
32
    }
8✔
33
    std::string env_str(env);
×
34
    std::transform(env_str.begin(), env_str.end(), env_str.begin(), ::tolower);
×
35
    if (env_str == "1" || env_str == "true") {
×
36
        return true;
×
37
    }
×
38
    return false;
×
39
}
×
40

41
void check_cuda_kernel_launch_errors(
42
    codegen::PrettyPrinter& stream, const codegen::LanguageExtension& language_extension, bool instrumented
43
) {
4✔
44
    if (!do_cuda_error_checking() && !instrumented) {
4✔
45
        return;
4✔
46
    }
4✔
47
    stream << "cudaError_t launch_err = cudaDeviceSynchronize();" << std::endl;
×
48
    cuda_error_checking(stream, language_extension, "launch_err");
×
49
    stream << "launch_err = cudaGetLastError();" << std::endl;
×
50
    cuda_error_checking(stream, language_extension, "launch_err");
×
51
}
×
52

53
} // namespace cuda
54
} // namespace sdfg
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc