-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwrapper_exec.c
More file actions
44 lines (34 loc) · 923 Bytes
/
wrapper_exec.c
File metadata and controls
44 lines (34 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <vaccel.h>
int vaccel_vector_add()
{
int ret = 0;
struct vaccel_session sess;
ret = vaccel_session_init(&sess, 0);
if (ret != VACCEL_OK) {
fprintf(stderr, "Could not initialize session\n");
return 1;
}
printf("Initialized session with id: %lu\n", sess.id);
char *library = "opencl_examples/build/vector_add/libvector_add.so";
char *operation = "vector_add";
ret = vaccel_exec(&sess, library, operation, NULL, 0, NULL, 0);
if (ret) {
fprintf(stderr, "Could not run op: %d\n", ret);
goto close_session;
}
close_session:
if (vaccel_session_release(&sess) != VACCEL_OK) {
fprintf(stderr, "Could not clear session\n");
return 1;
}
return ret;
}
int vector_add()
{
vaccel_vector_add();
return 0;
}