Skip to content

Commit 8b5c749

Browse files
author
Oscar Torreno
authored
Upgrade to ArrayFire 3.6.2 (#41)
1 parent cdaf8b8 commit 8b5c749

7 files changed

Lines changed: 42 additions & 39 deletions

File tree

.CI/travis/install-arrayfire.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,29 @@
77

88
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
99
brew install fftw freeimage
10-
if [ ! -e "./installers/arrayfire-unified-3.5.1.pkg " ]; then
11-
wget https://github.com/shapelets/arrayfire/releases/download/v3.5.1/arrayfire-unified-3.5.1.pkg -O ./installers/arrayfire-unified-3.5.1.pkg
10+
if [ ! -e "./installers/arrayfire-no-gl.pkg" ]; then
11+
wget https://github.com/shapelets/arrayfire/releases/download/v3.6.2/arrayfire-no-gl.pkg -O installers/arrayfire-no-gl.pkg
1212
fi
1313

1414
# Installs arrayfire
15-
sudo installer -pkg ./installers/arrayfire-unified-3.5.1.pkg -target /
15+
sudo installer -pkg ./installers/arrayfire-no-gl.pkg -target /
1616
else
17-
if [ ! -e "./installers/ArrayFire-no-gl-v3.5.1_Linux_x86_64.sh" ]; then
18-
wget http://arrayfire.s3.amazonaws.com/3.5.1/ArrayFire-no-gl-v3.5.1_Linux_x86_64.sh -O ./installers/ArrayFire-no-gl-v3.5.1_Linux_x86_64.sh
19-
chmod +x ./installers/ArrayFire-no-gl-v3.5.1_Linux_x86_64.sh
17+
sudo apt-get update && \
18+
sudo apt-get install -y libboost-all-dev \
19+
libfftw3-dev \
20+
libfontconfig1-dev \
21+
libfreeimage-dev \
22+
liblapack-dev \
23+
liblapacke-dev \
24+
libopenblas-dev
25+
26+
if [ ! -e "./installers/arrayfire-no-gl.sh" ]; then
27+
wget https://github.com/shapelets/arrayfire/releases/download/v3.6.2/arrayfire-no-gl.sh -O installers/arrayfire-no-gl.sh
2028
fi
2129

22-
sudo ./installers/ArrayFire-no-gl-v3.5.1_Linux_x86_64.sh --prefix=/usr/local --skip-license
30+
sudo mkdir -p /opt/arrayfire-3
31+
sudo bash installers/arrayfire-no-gl.sh --prefix=/opt/arrayfire-3 --skip-license
32+
sudo ln -s /opt/arrayfire-3/lib64 /opt/arrayfire-3/lib
33+
echo "/opt/arrayfire-3/lib" | sudo tee /etc/ld.so.conf.d/arrayfire.conf
34+
sudo ldconfig
2335
fi

.CI/travis/install-khiva.sh

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# License, v. 2.0. If a copy of the MPL was not distributed with this
66
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
77

8-
if [["$INSTALL_KHIVA_METHOD" == "installer"]]; then
8+
if [[ "$INSTALL_KHIVA_METHOD" == "installer" ]]; then
99
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
1010
if [ ! -e "./installers/khiva-v0.1.0.pkg" ]; then
1111
wget https://github.com/shapelets/khiva/releases/download/v0.1.0/khiva-v0.1.0-OnlyCPU.pkg -O ./installers/khiva-v0.1.0-OnlyCPU.pkg
@@ -26,18 +26,12 @@ else
2626
# Install cmake in Linux, it is already installed in osx
2727
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
2828
# Check if the file already exists
29-
if [ ! -e "${TRAVIS_BUILD_DIR}/cmake/cmake-3.11.3-Linux-x86_64.sh" ]; then
30-
mkdir -p cmake && cd cmake
31-
wget https://cmake.org/files/v3.11/cmake-3.11.3-Linux-x86_64.sh
32-
cd ..
29+
if [ ! -e "${TRAVIS_BUILD_DIR}/cmakebin/cmake-3.13.2-Linux-x86_64.sh" ]; then
30+
mkdir -p cmakebin
31+
wget https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2-Linux-x86_64.sh -O cmakebin/cmake-3.13.2-Linux-x86_64.sh
3332
fi
3433
# Install cmake
35-
mkdir cmakebin
36-
cp cmake/cmake-3.11.3-Linux-x86_64.sh cmakebin/cmake-3.11.3-Linux-x86_64.sh
37-
cd cmakebin
38-
chmod +x cmake-3.11.3-Linux-x86_64.sh
39-
sudo ./cmake-3.11.3-Linux-x86_64.sh --skip-license
40-
cd ..
34+
sudo bash cmakebin/cmake-3.13.2-Linux-x86_64.sh --prefix=./cmakebin/ --skip-license
4135
fi
4236

4337
#Installing conan and dependencies
@@ -48,7 +42,7 @@ else
4842
fi
4943

5044
conan remote add conan-mpusz https://api.bintray.com/conan/mpusz/conan-mpusz
51-
if [$? -ne 0]; then
45+
if [ $? -ne 0 ]; then
5246
conan remote update conan-mpusz https://api.bintray.com/conan/mpusz/conan-mpusz
5347
fi
5448

@@ -61,7 +55,7 @@ else
6155
cmake .. -DKHIVA_ONLY_CPU_BACKEND=ON -DKHIVA_BUILD_DOCUMENTATION=OFF -DKHIVA_BUILD_EXAMPLES=OFF -DKHIVA_BUILD_BENCHMARKS=OFF
6256
make install -j8
6357
else
64-
conan install .. --build missing
58+
conan install .. -s compiler.libcxx=libstdc++11 --build missing
6559
../../cmakebin/bin/cmake .. -DKHIVA_ENABLE_COVERAGE=ON -DKHIVA_BUILD_DOCUMENTATION=OFF -DKHIVA_BUILD_EXAMPLES=OFF -DKHIVA_BUILD_BENCHMARKS=OFF
6660
sudo make install -j8
6761
sudo ldconfig

.appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ clone_folder: C:\khiva-python
2222
platform:
2323
- x64
2424
before_build:
25-
- ps: if(!(Test-Path -Path "C:\Program Files\ArrayFire" )){ appveyor DownloadFile "https://www.dropbox.com/s/ndt1eaouriiu4qi/ArrayFire-v3.5.1.zip?dl=1" -FileName ArrayFire-v3.5.1.zip }
26-
- ps: if(!(Test-Path -Path "C:\Program Files\ArrayFire" )){ 7z x ArrayFire-v3.5.1.zip -o"C:\Program Files" }
25+
- ps: if(!(Test-Path -Path "C:\Program Files\ArrayFire" )){ appveyor DownloadFile "https://www.dropbox.com/s/13wnbd1qynjmw0i/ArrayFire-v3.6.2.zip?dl=1" -FileName ArrayFire-v3.6.2.zip }
26+
- ps: if(!(Test-Path -Path "C:\Program Files\ArrayFire" )){ 7z x ArrayFire-v3.6.2.zip -o"C:\Program Files" }
2727
- reg add HKCU\Software\Kitware\CMake\Packages\ArrayFire /v ArrayFire_CMake_DIR /d "C:\Program Files\ArrayFire\v3\cmake" /f
2828
- vcpkg install --triplet x64-windows gtest eigen3
2929
- ps: if ($env:INSTALL_KHIVA_METHOD -eq "installer"){

.travis.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,34 @@ matrix:
1010
fast_finish: true
1111
include:
1212
- os: linux
13-
dist: trusty
13+
dist: xenial
1414
sudo: required
1515
python: "3.6"
1616
cache:
1717
directories:
1818
- ${TRAVIS_BUILD_DIR}/installers
1919
- ${HOME}/.conan
20-
- ${TRAVIS_BUILD_DIR}/cmake
20+
- ${TRAVIS_BUILD_DIR}/cmakebin
2121
after_success:
2222
- codecov -F Linux -X gcov
2323
- os: linux
24-
dist: trusty
24+
dist: xenial
2525
sudo: required
2626
python: "3.5"
2727
cache:
2828
directories:
2929
- ${TRAVIS_BUILD_DIR}/installers
3030
- ${HOME}/.conan
31-
- ${TRAVIS_BUILD_DIR}/cmake
31+
- ${TRAVIS_BUILD_DIR}/cmakebin
3232
- os: linux
33-
dist: trusty
33+
dist: xenial
3434
sudo: required
3535
python: "2.7"
3636
cache:
3737
directories:
3838
- ${TRAVIS_BUILD_DIR}/installers
3939
- ${HOME}/.conan
40-
- ${TRAVIS_BUILD_DIR}/cmake
40+
- ${TRAVIS_BUILD_DIR}/cmakebin
4141
- os: osx
4242
osx_image: xcode9.3
4343
language: generic
@@ -49,7 +49,6 @@ matrix:
4949
- $HOME/.pyenv
5050
- $HOME/Library/Caches/Homebrew
5151
- ${HOME}/.conan
52-
- ${TRAVIS_BUILD_DIR}/cmake
5352
after_success:
5453
- codecov -F MacOS -X gcov
5554
- os: osx
@@ -63,7 +62,6 @@ matrix:
6362
- $HOME/.pyenv
6463
- $HOME/Library/Caches/Homebrew
6564
- ${HOME}/.conan
66-
- ${TRAVIS_BUILD_DIR}/cmake
6765
- os: osx
6866
osx_image: xcode9.3
6967
language: generic
@@ -75,7 +73,6 @@ matrix:
7573
- $HOME/.pyenv
7674
- $HOME/Library/Caches/Homebrew
7775
- ${HOME}/.conan
78-
- ${TRAVIS_BUILD_DIR}/cmake
7976
install:
8077
- source .CI/travis/install.sh
8178
- source .CI/travis/install-arrayfire.sh

khiva/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def _create_array(self, data):
171171
if isinstance(data, list):
172172
data = np.asarray(data)
173173
if isinstance(data, pd.DataFrame):
174-
data = data.as_matrix()
174+
data = data.values
175175
shape = np.array(data.shape)
176176
shape = shape[shape > 1]
177177
shape = deque(shape)

tests/unit_tests/array_unit_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def testArrayfire(self):
282282
def testFromPandas(self):
283283
df = pd.DataFrame([[1, 2, 3, 4], [5, 6, 7, 8]])
284284
df_array = Array(df, khiva_type=dtype.s32)
285-
np.testing.assert_array_equal(df.as_matrix(), df_array.to_pandas().as_matrix())
285+
np.testing.assert_array_equal(df.values, df_array.to_pandas().values)
286286

287287
def testLength(self):
288288
a = Array([1, 2, 3, 4])

tests/unit_tests/matrix_unit_tests.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def test_find_best_n_discords(self):
100100
a = find_best_n_discords_result[2].to_numpy()
101101

102102
self.assertEqual(a[0], 0)
103-
# The test failed in the CPU used in the Travis CI OSX build machine
104-
if os.environ.get("TRAVIS_OS_NAME") == "osx":
103+
# The test failed in the CPU used in the Travis CI build machine
104+
if os.environ.get("TRAVIS") == "true":
105105
self.assertEqual(a[1], 2)
106106
else:
107107
self.assertEqual(a[1], 10)
@@ -117,8 +117,8 @@ def test_find_best_n_discords_multiple_profiles(self):
117117
stomp_result[1], 3, 2)
118118
a = find_best_n_discords_result[2].to_numpy()
119119

120-
# The test failed in the CPU used in the Travis CI OSX build machine
121-
if os.environ.get("TRAVIS_OS_NAME") == "osx":
120+
# The test failed in the CPU used in the Travis CI build machine
121+
if os.environ.get("TRAVIS") == "true":
122122
np.testing.assert_array_almost_equal(a, np.array([[[0, 2], [0, 2]], [[0, 2], [0, 2]]]),
123123
decimal=self.DECIMAL)
124124
else:
@@ -143,8 +143,8 @@ def test_find_best_n_discords_consecutive(self):
143143
a = find_best_n_discords_result[2].to_numpy()
144144

145145
self.assertEqual(a[0], 12)
146-
# The test failed in the CPU used in the Travis CI OSX build machine
147-
if os.environ.get("TRAVIS_OS_NAME") == "osx":
146+
# The test failed in the CPU used in the Travis CI build machine
147+
if os.environ.get("TRAVIS") == "true":
148148
self.assertEqual(a[1], 11)
149149
else:
150150
self.assertNotEqual(a[1], 11)

0 commit comments

Comments
 (0)