Skip to content

Commit 309e87b

Browse files
committed
Fixes for macOS (we don't blacklist there).
1 parent 85e2a50 commit 309e87b

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/loaders/dyn_load.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ float ga_lib_version(void *h, void *sym) {
3737
if (!dladdr(sym, &dli))
3838
return -1;
3939

40-
real_path = realpath(dli.dli_fname,NULL);
40+
real_path = realpath(dli.dli_fname, NULL);
4141
if (real_path == NULL)
4242
return -1;
4343

4444
dot1 = strrchr(real_path, '.');
45-
if (dot1 == real_path) {
45+
if (dot1 == NULL) {
4646
free(real_path);
4747
return -1;
4848
}
4949
dot1[0] = '\0';
5050

5151
dot2 = strrchr(real_path, '.');
52-
if (dot2 == real_path) {
52+
if (dot2 == NULL) {
5353
free(real_path);
5454
return -1;
5555
}

src/loaders/libcuda.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
static char libname[] = "nvcuda.dll";
1111
#else /* Unix */
1212
#ifdef __APPLE__
13-
static char libname[] = "CUDA.framework/CUDA";
13+
static char libname[] = "/Library/Frameworks/CUDA.framework/CUDA";
1414
#else
1515
static char libname[] = "libcuda.so";
1616
#endif
@@ -42,7 +42,9 @@ static int loaded = 0;
4242

4343
int load_libcuda(void) {
4444
void *lib;
45+
#ifndef __APPLE__
4546
float v;
47+
#endif
4648

4749
if (loaded)
4850
return GA_NO_ERROR;
@@ -53,6 +55,10 @@ int load_libcuda(void) {
5355

5456
#include "libcuda.fn"
5557

58+
/*
59+
* The blacklisted versions of cuda are not available on mac as far as I know.
60+
*/
61+
#ifndef __APPLE__
5662
v = ga_lib_version(lib, cuInit);
5763
if (v == -1)
5864
fprintf(stderr, "WARNING: could not determine cuda driver version. Some versions return bad results, make sure your version is fine\n");
@@ -72,6 +78,7 @@ int load_libcuda(void) {
7278
return GA_LOAD_ERROR;
7379
}
7480
}
81+
#endif
7582

7683
loaded = 1;
7784
return GA_NO_ERROR;

src/loaders/libopencl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
static char libname[] = "OpenCL.dll";
99
#else /* Unix */
1010
#ifdef __APPLE__
11-
static char libname[] = "OpenCL.framework/OpenCL";
11+
static char libname[] = "/System/Library/Frameworks/OpenCL.framework/OpenCL";
1212
#else
1313
static char libname[] = "libOpenCL.so";
1414
#endif

0 commit comments

Comments
 (0)