Skip to content

Commit

Permalink
Merge pull request #998 from arrayfire/hotfixes-3.1.1
Browse files Browse the repository at this point in the history
Hotfixes 3.1.1
  • Loading branch information
pavanky committed Sep 13, 2015
2 parents e6acad6 + 169af41 commit 92e08e9
Show file tree
Hide file tree
Showing 23 changed files with 286 additions and 121 deletions.
25 changes: 25 additions & 0 deletions CMakeModules/FindCBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@ SET(CBLAS_INCLUDE_DIR CACHE STRING
SET(CBLAS_INCLUDE_FILE CACHE STRING
"CBLAS header name")


# If a valid PkgConfig configuration for cblas is found, this overrides and cancels
# all further checks.
FIND_PACKAGE(PkgConfig)
IF(PKG_CONFIG_FOUND)
PKG_CHECK_MODULES(PC_CBLAS cblas)
ENDIF(PKG_CONFIG_FOUND)

IF(PC_CBLAS_FOUND)

FOREACH(PC_LIB ${PC_CBLAS_LIBRARIES})
FIND_LIBRARY(${PC_LIB}_LIBRARY NAMES ${PC_LIB} HINTS ${PC_CBLAS_LIBRARY_DIRS} )
IF (NOT ${PC_LIB}_LIBRARY)
message(FATAL_ERROR "Something is wrong in your pkg-config file - lib ${PC_LIB} not found in ${PC_CBLAS_LIBRARY_DIRS}")
ENDIF (NOT ${PC_LIB}_LIBRARY)
LIST(APPEND CBLAS_LIBRARIES ${${PC_LIB}_LIBRARY})
ENDFOREACH(PC_LIB)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(CBLAS DEFAULT_MSG CBLAS_LIBRARIES)
MARK_AS_ADVANCED(CBLAS_LIBRARIES)

ELSE(PC_CBLAS_FOUND)

SET(INTEL_MKL_ROOT_DIR CACHE STRING
"Root directory of the Intel MKL")

Expand Down Expand Up @@ -277,3 +300,5 @@ IF(NOT CBLAS_FIND_QUIETLY)
MESSAGE(STATUS "CBLAS library not found.")
ENDIF()
ENDIF(NOT CBLAS_FIND_QUIETLY)

ENDIF(PC_CBLAS_FOUND)
144 changes: 86 additions & 58 deletions CMakeModules/FindLAPACKE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,78 +18,106 @@ FIND_PACKAGE(PkgConfig)

#Determine from PKG
IF(PKG_CONFIG_FOUND AND NOT LAPACKE_ROOT)
PKG_CHECK_MODULES( PKG_LAPACKE QUIET "lapacke")
PKG_CHECK_MODULES( PC_LAPACKE QUIET "lapacke")
ENDIF()

IF(LAPACKE_ROOT)
#find libs
FIND_LIBRARY(
LAPACKE_LIB
NAMES "lapacke" "LAPACKE" "liblapacke"
PATHS ${LAPACKE_ROOT}
PATH_SUFFIXES "lib" "lib64"
DOC "LAPACKE Library"
NO_DEFAULT_PATH
)
FIND_LIBRARY(
LAPACK_LIB
NAMES "lapack" "LAPACK" "liblapack"
PATHS ${LAPACKE_ROOT}
PATH_SUFFIXES "lib" "lib64"
DOC "LAPACK Library"
NO_DEFAULT_PATH
)
FIND_PATH(
LAPACKE_INCLUDES
NAMES "lapacke.h"
PATHS ${LAPACKE_ROOT}
PATH_SUFFIXES "include"
DOC "LAPACKE Include Directory"
NO_DEFAULT_PATH
)
IF(PC_LAPACKE_FOUND)
FOREACH(PC_LIB ${PC_LAPACKE_LIBRARIES})
FIND_LIBRARY(${PC_LIB}_LIBRARY NAMES ${PC_LIB} HINTS ${PC_LAPACKE_LIBRARY_DIRS} )
IF (NOT ${PC_LIB}_LIBRARY)
MESSAGE(FATAL_ERROR "Something is wrong in your pkg-config file - lib ${PC_LIB} not found in ${PC_LAPACKE_LIBRARY_DIRS}")
ENDIF (NOT ${PC_LIB}_LIBRARY)
LIST(APPEND LAPACKE_LIB ${${PC_LIB}_LIBRARY})
ENDFOREACH(PC_LIB)

ELSE()
FIND_LIBRARY(
LAPACKE_LIB
NAMES "lapacke" "liblapacke"
PATHS
${PKG_LAPACKE_LIBRARY_DIRS}
${LIB_INSTALL_DIR}
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "LAPACKE Library"
)
FIND_LIBRARY(
LAPACK_LIB
NAMES "lapack" "liblapack"
PATHS
${PKG_LAPACKE_LIBRARY_DIRS}
${LIB_INSTALL_DIR}
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "LAPACK Library"
)
FIND_PATH(
LAPACKE_INCLUDES
NAMES "lapacke.h"
PATHS
${PKG_LAPACKE_INCLUDE_DIRS}
${PC_LAPACKE_INCLUDE_DIRS}
${INCLUDE_INSTALL_DIR}
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "LAPACKE Include Directory"
)
ENDIF(LAPACKE_ROOT)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(LAPACKE DEFAULT_MSG LAPACKE_LIB)
MARK_AS_ADVANCED(LAPACKE_INCLUDES LAPACKE_LIB)

ELSE(PC_LAPACKE_FOUND)

IF(LAPACKE_ROOT)
#find libs
FIND_LIBRARY(
LAPACKE_LIB
NAMES "lapacke" "LAPACKE" "liblapacke"
PATHS ${LAPACKE_ROOT}
PATH_SUFFIXES "lib" "lib64"
DOC "LAPACKE Library"
NO_DEFAULT_PATH
)
FIND_LIBRARY(
LAPACK_LIB
NAMES "lapack" "LAPACK" "liblapack"
PATHS ${LAPACKE_ROOT}
PATH_SUFFIXES "lib" "lib64"
DOC "LAPACK Library"
NO_DEFAULT_PATH
)
FIND_PATH(
LAPACKE_INCLUDES
NAMES "lapacke.h"
PATHS ${LAPACKE_ROOT}
PATH_SUFFIXES "include"
DOC "LAPACKE Include Directory"
NO_DEFAULT_PATH
)

ELSE()
FIND_LIBRARY(
LAPACKE_LIB
NAMES "lapacke" "liblapacke"
PATHS
${PC_LAPACKE_LIBRARY_DIRS}
${LIB_INSTALL_DIR}
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "LAPACKE Library"
)
FIND_LIBRARY(
LAPACK_LIB
NAMES "lapack" "liblapack"
PATHS
${PC_LAPACKE_LIBRARY_DIRS}
${LIB_INSTALL_DIR}
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "LAPACK Library"
)
FIND_PATH(
LAPACKE_INCLUDES
NAMES "lapacke.h"
PATHS
${PC_LAPACKE_INCLUDE_DIRS}
${INCLUDE_INSTALL_DIR}
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "LAPACKE Include Directory"
)
ENDIF(LAPACKE_ROOT)
ENDIF(PC_LAPACKE_FOUND)

SET(LAPACK_LIBRARIES ${LAPACKE_LIB} ${LAPACK_LIB})
SET(LAPACK_INCLUDE_DIR ${LAPACKE_INCLUDES})
Expand Down
2 changes: 1 addition & 1 deletion CMakeModules/Version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
SET(AF_VERSION_MAJOR "3")
SET(AF_VERSION_MINOR "1")
SET(AF_VERSION_PATCH "0")
SET(AF_VERSION_PATCH "1")

SET(AF_VERSION "${AF_VERSION_MAJOR}.${AF_VERSION_MINOR}.${AF_VERSION_PATCH}")
SET(AF_API_VERSION_CURRENT ${AF_VERSION_MAJOR}${AF_VERSION_MINOR})
Expand Down
2 changes: 1 addition & 1 deletion CMakeModules/build_forge.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ENDIF()
ExternalProject_Add(
forge-ext
GIT_REPOSITORY https://github.com/arrayfire/forge.git
GIT_TAG 79fac0b7ed35c96f25c8006075ec934729cf9dc4
GIT_TAG af3.1
PREFIX "${prefix}"
INSTALL_DIR "${prefix}"
UPDATE_COMMAND ""
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A few lines of code in ArrayFire can replace dozens of lines of parallel computi
To build ArrayFire from source, please follow the instructions on our [wiki](https://github.com/arrayfire/arrayfire/wiki).

### Download ArrayFire Installers
We currently have binary tar balls and installers available for the beta version of ArrayFire 3.0. These can be downloaded at the [ArrayFire Downloads](http://go.arrayfire.com/l/37882/2015-03-31/mmhqy) page.
ArrayFire binary installers can be downloaded at the [ArrayFire Downloads](http://go.arrayfire.com/l/37882/2015-03-31/mmhqy) page.

### Support and Contact Info [![Join the chat at https://gitter.im/arrayfire/arrayfire](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/arrayfire/arrayfire?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Expand Down Expand Up @@ -118,7 +118,7 @@ following reference:
Formatted:
```
Yalamanchili, P., Arshad, U., Mohammed, Z., Garigipati, P., Entschev, P.,
Kloppenborg, B., Malcolm, James and Melonakos, J. (2015).
Kloppenborg, B., Malcolm, J. and Melonakos, J. (2015).
ArrayFire - A high performance software library for parallel computing with an
easy-to-use API. Atlanta: AccelerEyes. Retrieved from https://github.com/arrayfire/arrayfire
```
Expand Down
40 changes: 32 additions & 8 deletions docs/pages/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
Release Notes {#releasenotes}
==============

v3.1.1
==============

Installers
-----------

* CUDA backend now depends on CUDA 7.5 toolkit
* OpenCL backend now require OpenCL 1.2 or greater

Bug Fixes
--------------

* Fixed [bug](https://github.com/arrayfire/arrayfire/issues/981) in reductions after indexing
* Fixed [bug](https://github.com/arrayfire/arrayfire/issues/976) in indexing when using reverse indices

Build
------

* `cmake` now includes `PKG_CONFIG` in the search path for CBLAS and LAPACKE libraries
* [heston_model.cpp](\ref heston_model.cpp) example now builds with the default ArrayFire cmake files after installation

Other
------

* Fixed bug in [image_editing.cpp](\ref image_editing.cpp)

v3.1.0
==============

Expand Down Expand Up @@ -105,7 +131,7 @@ Bug Fixes
* Fix compatibility of c32/c64 arrays when operating with scalars
* Fix median for all values of an array
* Fix double free issue when indexing (30cbbc7)
* Fix bug in rank
* Fix [bug](https://github.com/arrayfire/arrayfire/issues/901) in rank
* Fix default values for scale throwing exception
* Fix conjg raising exception on real input
* Fix bug when using conjugate transpose for vector input
Expand All @@ -115,20 +141,18 @@ Bug Fixes
* Fix setSeed for randu
* Fix casting to and from complex
* Check NULL values when allocating memory
* Fix offset issue for CPU element-wise operations
* Fix [offset issue](https://github.com/arrayfire/arrayfire/issues/923) for CPU element-wise operations

New Examples
------------
* Match Template
* Susan
* Heston Model (contributed by Michael Nowotny)

Distribution Changes
--------------------
* Fixed automatic detection of ArrayFire when using with CMake in the Windows
Installer
* Compiling ArrayFire with FreeImage as a static library for Linux x86
installers
Installer
----------
* Fixed bug in automatic detection of ArrayFire when using with CMake in Windows
* The Linux libraries are now compiled with static version of FreeImage

Known Issues
------------
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/using_on_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ to the location of the executables.
## Step 1: Adding ArrayFire to PATH for all users

The ArrayFire installer for Windows creates a user `PATH` variable containing
`%AF_PATH%/lib`. This is required so that Windows knows where to find the
`%%AF_PATH%/lib`. This is required so that Windows knows where to find the
ArrayFire DLLs. This variable fixes the DLL finding only for the user that
installs ArrayFire.

Expand All @@ -42,9 +42,9 @@ To allow DLL detection for all users, it needs to be added to the system
3. Click on _Environment Variables_, then under **System Variables**, find
`PATH`, and click on it.

4. In edit mode, append `%AF_PATH%/lib`. NOTE: Ensure that there is a semi-colon
separating `%AF_PATH%/lib` from any existing content (e.g.
`EXISTING_PATHS;%AF_PATH%/lib;`) otherwise other software may not function
4. In edit mode, append `%%AF_PATH%/lib`. NOTE: Ensure that there is a semi-colon
separating `%%AF_PATH%/lib` from any existing content (e.g.
`EXISTING_PATHS;%%AF_PATH%/lib;`) otherwise other software may not function
correctly.

## Step 2: Verify the path addition functions correctly
Expand Down
20 changes: 10 additions & 10 deletions examples/financial/heston_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,21 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************/

#include <stdio.h>
#include <iostream>
#include <arrayfire.h>
#include <vector>
#include <tuple>

using namespace std;
using namespace af;

tuple<af::array, af::array>
simulateHestonModel(float T, unsigned int N, unsigned int R, float mu, float kappa,
float vBar, float sigmaV, float rho, float x0, float v0)
void simulateHestonModel(af::array &xres, af::array &vres,
float T, unsigned int N, unsigned int R, float mu, float kappa,
float vBar, float sigmaV, float rho, float x0, float v0)
{
float deltaT = T / (float)(N - 1);

std::vector<af::array> x = {af::constant(x0, R), af::constant(0, R)};
std::vector<af::array> v = {af::constant(v0, R), af::constant(0, R)};
af::array x[] = {af::constant(x0, R), af::constant(0, R)};
af::array v[] = {af::constant(v0, R), af::constant(0, R)};

float sqrtDeltaT = sqrt(deltaT);

Expand All @@ -68,7 +67,8 @@ simulateHestonModel(float T, unsigned int N, unsigned int R, float mu, float kap
v[tCurrent] = max(vTmp, zeroConstant);
}

return std::make_tuple(x[tCurrent], v[tCurrent]);
xres = x[tCurrent];
vres = v[tCurrent];
}

int main()
Expand All @@ -94,11 +94,11 @@ int main()
af::array v;

// first run
std::tie(x, v) = simulateHestonModel(T, nT, R_first_run, r, kappa, vBar, sigmaV, rho, x0, v0);
simulateHestonModel(x, v, T, nT, R_first_run, r, kappa, vBar, sigmaV, rho, x0, v0);
af::sync(); // Ensure the first run is finished

timer::start();
std::tie(x, v) = simulateHestonModel(T, nT, R, r, kappa, vBar, sigmaV, rho, x0, v0);
simulateHestonModel(x, v, T, nT, R, r, kappa, vBar, sigmaV, rho, x0, v0);
af::sync();
cout << "Time in simulation: " << timer::stop() << endl;

Expand Down
2 changes: 1 addition & 1 deletion examples/image_processing/image_editing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int main(int argc, char **argv)

array man = loadImage(ASSETS_DIR "/examples/images/man.jpg", true);
array fight = loadImage(ASSETS_DIR "/examples/images/fight.jpg", true);
array nature = loadImage(ASSETS_DIR "/examples/images/nature.jpg", true);
array nature = resize(loadImage(ASSETS_DIR "/examples/images/nature.jpg", true), fight.dims(0), fight.dims(1));

array intensity = colorSpace(fight, AF_GRAY, AF_RGB);
array mask = clamp(intensity, 10.0f, 255.0f)>0.0f;
Expand Down

0 comments on commit 92e08e9

Please sign in to comment.