Skip to content

Commit

Permalink
Merge pull request #1200 from arrayfire/hotfixes-3.2.2
Browse files Browse the repository at this point in the history
Hotfixes 3.2.2
  • Loading branch information
pavanky committed Dec 30, 2015
2 parents f263db0 + 005894e commit 7507b61
Show file tree
Hide file tree
Showing 122 changed files with 1,122 additions and 641 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ GRTAGS
GPATH
.dir-locals.el
include/af/version.h
src/backend/version.hpp
docs/details/examples.dox
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"MinSizeRel" "RelWithDebInfo")
endif()

OPTION(MIN_BUILD_TIME "This flag compiles ArrayFire with O0, which is the fastest way to compile" OFF)
INCLUDE(${CMAKE_MODULE_PATH}/MinBuildTime.cmake)

FIND_PACKAGE(FreeImage)
IF(FREEIMAGE_FOUND)
ADD_DEFINITIONS(-DWITH_FREEIMAGE)
Expand Down Expand Up @@ -145,6 +148,13 @@ IF(UNIX)
ENDIF()
ELSE(${UNIX}) #Windows
ADD_DEFINITIONS(-DOS_WIN -DNOMINMAX)
IF(MSVC)
# MP is multiprocess compilation. Gm- disables minimal rebuilds
# http://stackoverflow.com/questions/6172205/how-can-i-do-a-parallel-build-in-visual-studio-2010vvvvvvvv
# http://www.kitware.com/blog/home/post/434
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Gm-")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /Gm-")
ENDIF(MSVC)
ENDIF()

# Architechture Definitions
Expand Down
52 changes: 22 additions & 30 deletions CMakeModules/FindCBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ IF(PC_CBLAS_FOUND)
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})
LIST(APPEND CBLAS_LIBRARIES ${${PC_LIB}_LIBRARY})
ENDFOREACH(PC_LIB)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(CBLAS DEFAULT_MSG CBLAS_LIBRARIES)
Expand Down Expand Up @@ -146,12 +146,12 @@ MACRO(CHECK_ALL_LIBRARIES

SET(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
SET(_libraries_work ${${_prefix}_${_library}_LIBRARY})

ENDIF(_libraries_work)
ENDFOREACH(_library)

# Test include
SET(_bug_search_include ${_search_include}) #CMAKE BUG!!! SHOULD NOT BE THAT
SET(_bug_libraries_work_check ${_libraries_work_check}) #CMAKE BUG!!! SHOULD NOT BE THAT

IF(_bug_search_include)
FIND_PATH(${_prefix}${_combined_name}_INCLUDE ${_include} ${_paths})
Expand All @@ -170,18 +170,21 @@ MACRO(CHECK_ALL_LIBRARIES
SET(${_prefix}_INCLUDE_FILE ${_include})
ENDIF(_bug_search_include)


IF (_libraries_work_check)
IF (_bug_libraries_work_check)
# Test this combination of libraries.
IF(_libraries_work)
SET(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}})
CHECK_FUNCTION_EXISTS(${_name} ${_prefix}${_combined_name}_WORKS)
SET(CMAKE_REQUIRED_LIBRARIES)
MARK_AS_ADVANCED(${_prefix}${_combined_name}_WORKS)
SET(_libraries_work ${${_prefix}${_combined_name}_WORKS})

IF(_verbose AND _libraries_work)
MESSAGE(STATUS "Libraries found")
MESSAGE(STATUS "CBLAS Symbols FOUND")
ELSE()
MESSAGE(STATUS "CBLAS Symbols NOTFOUND")
ENDIF(_verbose AND _libraries_work)

ENDIF(_libraries_work)
ENDIF()

Expand Down Expand Up @@ -216,31 +219,6 @@ IF( NOT CBLAS_LIBRARIES )
TRUE)
ENDIF( NOT CBLAS_LIBRARIES )

# MKL
IF (INTEL_MKL_ROOT_DIR)
IF ("${SIZE_OF_VOIDP}" EQUAL 8)
SET(MKL_CBLAS_EXT mkl_gf_lp64)
ELSE()
SET(MKL_CBLAS_EXT mkl_gf)
ENDIF()

IF(NOT CBLAS_LIBRARIES)
CHECK_ALL_LIBRARIES(
CBLAS_LIBRARIES
CBLAS
cblas_dgemm
""
"${MKL_CBLAS_EXT};mkl_intel_thread"
"mkl_cblas.h"
TRUE,
FALSE)
ENDIF(NOT CBLAS_LIBRARIES)

IF (CBLAS_LIBRARIES)
SET(MKL_CBLAS_FOUND TRUE)
ENDIF()
ENDIF()

# CBLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
IF(NOT CBLAS_LIBRARIES)
CHECK_ALL_LIBRARIES(
Expand Down Expand Up @@ -280,6 +258,20 @@ IF(NOT CBLAS_LIBRARIES)
TRUE)
ENDIF(NOT CBLAS_LIBRARIES)

# Generic BLAS+CBLAS library
# Debian based systems have them as single library
IF(NOT CBLAS_LIBRARIES)
CHECK_ALL_LIBRARIES(
CBLAS_LIBRARIES
CBLAS
cblas_dgemm
""
"blas"
"cblas.h"
TRUE,
TRUE)
ENDIF(NOT CBLAS_LIBRARIES)

IF(CBLAS_LIBRARIES)
IF (NOT MKL_CBLAS_FOUND)
SET(CBLAS_FOUND TRUE)
Expand Down
6 changes: 3 additions & 3 deletions CMakeModules/FindLAPACKE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ IF(PC_LAPACKE_FOUND)
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})
LIST(APPEND LAPACKE_LIB ${${PC_LIB}_LIBRARY})
ENDFOREACH(PC_LIB)

FIND_PATH(
Expand Down Expand Up @@ -78,7 +78,7 @@ ELSE(PC_LAPACKE_FOUND)
ELSE()
FIND_LIBRARY(
LAPACKE_LIB
NAMES "lapacke" "liblapacke"
NAMES "lapacke" "liblapacke" "openblas"
PATHS
${PC_LAPACKE_LIBRARY_DIRS}
${LIB_INSTALL_DIR}
Expand All @@ -92,7 +92,7 @@ ELSE(PC_LAPACKE_FOUND)
)
FIND_LIBRARY(
LAPACK_LIB
NAMES "lapack" "liblapack"
NAMES "lapack" "liblapack" "openblas"
PATHS
${PC_LAPACKE_LIBRARY_DIRS}
${LIB_INSTALL_DIR}
Expand Down
93 changes: 93 additions & 0 deletions CMakeModules/MinBuildTime.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
IF(NOT DEFINED MINBUILDTIME_FLAG)
SET(MINBUILDTIME_FLAG OFF CACHE INTERNAL "Flag" FORCE)
ENDIF()

IF(${MIN_BUILD_TIME})
IF(NOT ${CMAKE_BUILD_TYPE} MATCHES "Release")
MESSAGE(WARNING "The MIN_BUILD_TIME Flag only works with Release.\
Other CMAKE_BUILD_TYPEs will be ignore this flag")
ELSEIF(NOT ${MINBUILDTIME_FLAG})
# BUILD_TYPE is Release - Set the flags
# The flags should be set only when going from OFF -> ON. This is
# determined by MINBUILDTIME_FLAG
# IF FLAG is ON, then the flags were already set, no need to set them again
# IF FLAG is OFF, then the flags are not set, so set them now, and back up
# release flags
MESSAGE(STATUS "Setting Release flags to no optimizations")

# Backup Default Release Flags
SET(CMAKE_CXX_FLAGS_RELEASE_DEFAULT ${CMAKE_CXX_FLAGS_RELEASE} CACHE
INTERNAL "Default compiler flags during release build" FORCE)
SET(CMAKE_C_FLAGS_RELEASE_DEFAULT ${CMAKE_C_FLAGS_RELEASE} CACHE
INTERNAL "Default compiler flags during release build" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_DEFAULT ${CMAKE_EXE_LINKER_FLAGS_RELEASE} CACHE
INTERNAL "Default linker flags during release build" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE_DEFAULT ${CMAKE_MODULE_LINKER_FLAGS_RELEASE} CACHE
INTERNAL "Default linker flags during release build" FORCE)
SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE_DEFAULT ${CMAKE_STATIC_LINKER_FLAGS_RELEASE} CACHE
INTERNAL "Default linker flags during release build" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE_DEFAULT ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} CACHE
INTERNAL "Default linker flags during release build" FORCE)

IF(MSVC)
MESSAGE(STATUS "MSVC Flags")
SET(CMAKE_CXX_FLAGS_RELEASE "/MD /Od /Ob1 /D NDEBUG" CACHE
STRING "Flags used by the compiler during release builds." FORCE)
SET(CMAKE_C_FLAGS_RELEASE "/MD /Od /Ob1 /D NDEBUG" CACHE
STRING "Flags used by the compiler during release builds." FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO" CACHE
STRING "Flags used by the linker during release builds." FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO" CACHE
STRING "Flags used by the linker during release builds." FORCE)
SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "" CACHE
STRING "Flags used by the linker during release builds." FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO" CACHE
STRING "Flags used by the linker during release builds." FORCE)
ELSE(MSVC)
MESSAGE(STATUS "Other Flags")
SET(CMAKE_CXX_FLAGS_RELEASE "-O0 -DNDEBUG" CACHE
STRING "Flags used by the compiler during release builds." FORCE)
SET(CMAKE_C_FLAGS_RELEASE "-O0 -DNDEBUG" CACHE
STRING "Flags used by the compiler during release builds." FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "" CACHE
STRING "Flags used by the linker during release builds." FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "" CACHE
STRING "Flags used by the linker during release builds." FORCE)
SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE "" CACHE
STRING "Flags used by the linker during release builds." FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "" CACHE
STRING "Flags used by the linker during release builds." FORCE)
ENDIF(MSVC)

SET(MINBUILDTIME_FLAG ON CACHE INTERNAL "Flag" FORCE)
ENDIF()
ELSE()
MESSAGE(STATUS "MIN_BUILD_TIME IS OFF")

# MIN_BUILD_TIME is OFF. Change the flags back only if the flag was set before
IF(${MINBUILDTIME_FLAG})
MESSAGE(STATUS "MIN_BUILD_FLAG was toggled. Resetting Release FLags")
SET(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE_DEFAULT} CACHE
STRING "Flags used by the compiler during release builds." FORCE)
SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE_DEFAULT} CACHE
STRING "Flags used by the compiler during release builds." FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_EXE_LINKER_FLAGS_RELEASE_DEFAULT} CACHE
STRING "Flags used by the linker during release builds." FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_MODULE_LINKER_FLAGS_RELEASE_DEFAULT} CACHE
STRING "Flags used by the linker during release builds." FORCE)
SET(CMAKE_STATIC_LINKER_FLAGS_RELEASE ${CMAKE_STATIC_LINKER_FLAGS_RELEASE_DEFAULT} CACHE
STRING "Flags used by the linker during release builds." FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE_DEFAULT} CACHE
STRING "Flags used by the linker during release builds." FORCE)
SET(MINBUILDTIME_FLAG OFF CACHE INTERNAL "Flag" FORCE)
ENDIF()
ENDIF()

MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_MODULE_LINKER_FLAGS_RELEASE
CMAKE_STATIC_LINKER_FLAGS_RELEASE
CMAKE_SHARED_LINKER_FLAGS_RELEASE
)
7 changes: 6 additions & 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 "2")
SET(AF_VERSION_PATCH "1")
SET(AF_VERSION_PATCH "2")

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 Expand Up @@ -36,3 +36,8 @@ CONFIGURE_FILE(
${CMAKE_MODULE_PATH}/version.h.in
${CMAKE_SOURCE_DIR}/include/af/version.h
)

CONFIGURE_FILE(
${CMAKE_MODULE_PATH}/version.hpp.in
${CMAKE_SOURCE_DIR}/src/backend/version.hpp
)
6 changes: 3 additions & 3 deletions CMakeModules/build_clBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ELSE()
ENDIF()

ExternalProject_Add(
clBLAS-external
clBLAS-ext
GIT_REPOSITORY https://github.com/arrayfire/clBLAS.git
GIT_TAG 102c832825e8e4d60ad73ca97e95668463294068
PREFIX "${prefix}"
Expand All @@ -33,10 +33,10 @@ ExternalProject_Add(
${byproducts}
)

ExternalProject_Get_Property(clBLAS-external install_dir)
ExternalProject_Get_Property(clBLAS-ext install_dir)
ADD_LIBRARY(clBLAS IMPORTED STATIC)
SET_TARGET_PROPERTIES(clBLAS PROPERTIES IMPORTED_LOCATION ${clBLAS_location})
ADD_DEPENDENCIES(clBLAS clBLAS-external)
ADD_DEPENDENCIES(clBLAS clBLAS-ext)
SET(CLBLAS_INCLUDE_DIRS ${install_dir}/include)
SET(CLBLAS_LIBRARIES clBLAS)
SET(CLBLAS_FOUND ON)
6 changes: 3 additions & 3 deletions CMakeModules/build_clFFT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ELSE()
ENDIF()

ExternalProject_Add(
clFFT-external
clFFT-ext
GIT_REPOSITORY https://github.com/arrayfire/clFFT.git
GIT_TAG 1597f0f35a644789c7ad77efe79014236cca2fab
PREFIX "${prefix}"
Expand All @@ -34,10 +34,10 @@ ExternalProject_Add(
${byproducts}
)

ExternalProject_Get_Property(clFFT-external install_dir)
ExternalProject_Get_Property(clFFT-ext install_dir)
ADD_LIBRARY(clFFT IMPORTED STATIC)
SET_TARGET_PROPERTIES(clFFT PROPERTIES IMPORTED_LOCATION ${clFFT_location})
ADD_DEPENDENCIES(clFFT clFFT-external)
ADD_DEPENDENCIES(clFFT clFFT-ext)
SET(CLFFT_INCLUDE_DIRS ${install_dir}/include)
SET(CLFFT_LIBRARIES clFFT)
SET(CLFFT_FOUND ON)
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 af3.2.1
GIT_TAG af3.2.2
PREFIX "${prefix}"
INSTALL_DIR "${prefix}"
UPDATE_COMMAND ""
Expand Down
2 changes: 0 additions & 2 deletions CMakeModules/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@
#define AF_VERSION_MINOR @AF_VERSION_MINOR@
#define AF_VERSION_PATCH @AF_VERSION_PATCH@
#define AF_API_VERSION_CURRENT @AF_API_VERSION_CURRENT@
#define AF_REVISION "@GIT_COMMIT_HASH@"
#define AF_CMPLR_STR "@AF_COMPILER_STRING@"
13 changes: 13 additions & 0 deletions CMakeModules/version.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/

#pragma once

#define AF_REVISION "@GIT_COMMIT_HASH@"
#define AF_COMPILER_STR "@AF_COMPILER_STRING@"
5 changes: 5 additions & 0 deletions docs/arrayfire.css
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,9 @@ div.fragment
border : 1px solid #DFDFDF;
}

pre
{
overflow : hidden;
}

/* @end */
9 changes: 9 additions & 0 deletions docs/details/backend.dox
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ Return Value | Backends Available
6 | CUDA and OpenCL
7 | CPU, CUDA and OpenCL

To convert the integer back into bools for each device, use the following code
\code
int backends = af::getAvailableBackends();

bool cpu = backends & AF_BACKEND_CPU;
bool cuda = backends & AF_BACKEND_CUDA;
bool opencl = backends & AF_BACKEND_OPENCL;
\endcode

\ingroup unified_func
\ingroup arrayfire_func

Expand Down

0 comments on commit 7507b61

Please sign in to comment.