The Tutorial and API Reference of VEDA  3.3.0
examples/Hybrid_Offloading/helloworld_veda_c/host.c
#include <stdio.h>
#include <stdlib.h>
#include <veda.h>
#define VEDA(err) check(err, __FILE__, __LINE__)
void check(VEDAresult err, const char* file, const int line) {
if(err != VEDA_SUCCESS) {
const char *name, *str;
vedaGetErrorName (err, &name);
vedaGetErrorString (err, &str);
printf("%s: %s @ %s:%i\n", name, str, file, line);
exit(1);
}
}
int main(int argc, char** argv) {
printf("Hello World from Host!\n");
VEDA(vedaInit(0));
VEDAcontext ctx;
VEDA(vedaCtxPushCurrent(ctx));
VEDAmodule mod;
VEDA(vedaModuleLoad(&mod, "./libhello_world_device.vso"));
VEDAfunction func;
VEDA(vedaModuleGetFunction(&func, mod, "hello_world"));
VEDAargs args;
VEDA(vedaArgsCreate(&args));
VEDA(vedaLaunchKernel(func, 0, args));
VEDA(vedaArgsDestroy(args));
VEDA(vedaExit());
return 0;
}