user3564870
user3564870

Reputation: 395

CUDA Execution Configuration Syntax...How do you make the compiler recognize it?

Super simple program:

#include "cuda_runtime.h"
#include <iostream>

__global__ void kernal_function() 
{

}

int main(void) 
{
    kernal_function<<<1,1>>>();

    return 0;
}

Won't compile because the compiler doesn't know what the <<<>>> is (error: expected an expression and syntax error: '<').

How do I make the compiler understand what this (<<<>>>) is?

Upvotes: 0

Views: 556

Answers (1)

Robin Thoni
Robin Thoni

Reputation: 1721

The triple angle brackets syntax <<<...>>> is specific to CUDA. It not part of C or C++ standard. It will be recognized by nvcc, but not by gcc or any other 'classic' compiler.

You can build a CUDA runtime program this way:

nvcc main.cu -o my-program

Upvotes: 2

Related Questions