Skip to content

Commit 0188f8b

Browse files
committed
Fixing forge major version. Adding verbose options.
1 parent 9784791 commit 0188f8b

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

arrayfire/library.py

+22-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
import platform
1515
import ctypes as ct
16+
import traceback
17+
import os
1618

1719
c_float_t = ct.c_float
1820
c_double_t = ct.c_double
@@ -32,7 +34,7 @@
3234

3335

3436
AF_VER_MAJOR = '3'
35-
FORGE_VER_MAJOR = '0'
37+
FORGE_VER_MAJOR = '1'
3638

3739
# Work around for unexpected architectures
3840
if 'c_dim_t_forced' in globals():
@@ -424,7 +426,6 @@ class CANNY_THRESHOLD(_Enum):
424426

425427
def _setup():
426428
import platform
427-
import os
428429

429430
platform_name = platform.system()
430431

@@ -545,10 +546,23 @@ def __init__(self):
545546

546547
# Try to pre-load forge library if it exists
547548
libnames = self.__libname('forge', head='', ver_major=FORGE_VER_MAJOR)
549+
550+
try:
551+
VERBOSE_LOADS = os.environ['AF_VERBOSE_LOADS'] == '1'
552+
except KeyError:
553+
VERBOSE_LOADS = False
554+
pass
555+
548556
for libname in libnames:
549557
try:
550558
ct.cdll.LoadLibrary(libname)
559+
if VERBOSE_LOADS:
560+
print('Loaded ' + libname)
561+
break
551562
except OSError:
563+
if VERBOSE_LOADS:
564+
traceback.print_exc()
565+
print('Unable to load ' + libname)
552566
pass
553567

554568
c_dim4 = c_dim_t*4
@@ -568,8 +582,13 @@ def __init__(self):
568582
if (err == ERR.NONE.value):
569583
self.__name = __name
570584
clib.af_release_array(out)
571-
break;
585+
if VERBOSE_LOADS:
586+
print('Loaded ' + libname)
587+
break;
572588
except OSError:
589+
if VERBOSE_LOADS:
590+
traceback.print_exc()
591+
print('Unable to load ' + libname)
573592
pass
574593

575594
if (self.__name is None):

0 commit comments

Comments
 (0)