diff --git a/CMakeModules/build_forge.cmake b/CMakeModules/build_forge.cmake index 7adcc1b73d..b376895942 100644 --- a/CMakeModules/build_forge.cmake +++ b/CMakeModules/build_forge.cmake @@ -22,7 +22,7 @@ ENDIF() ExternalProject_Add( forge-ext GIT_REPOSITORY https://github.com/arrayfire/forge.git - GIT_TAG 0892228ec28902200c7903a707ea4afb96203192 + GIT_TAG 79fac0b7ed35c96f25c8006075ec934729cf9dc4 PREFIX "${prefix}" INSTALL_DIR "${prefix}" UPDATE_COMMAND "" diff --git a/docs/details/data.dox b/docs/details/data.dox index 1d35f4dd87..b60b678168 100644 --- a/docs/details/data.dox +++ b/docs/details/data.dox @@ -33,7 +33,24 @@ The distribution is centered around 0 \ingroup data_mat \ingroup arrayfire_func -======================================================================= + +\defgroup data_func_setseed setSeed + +\brief Set the seed for random number generator + + +\ingroup data_mat +\ingroup arrayfire_func + + +\defgroup data_func_getseed getSeed + +\brief Get the seed for random number generator + + +\ingroup data_mat +\ingroup arrayfire_func + \defgroup data_func_identity identity diff --git a/docs/details/image.dox b/docs/details/image.dox index d9e91e9f18..4e1b0a5cdc 100644 --- a/docs/details/image.dox +++ b/docs/details/image.dox @@ -790,7 +790,7 @@ unwrap(A, 3, 3, 3, 3, 2, 2) [9 9 1 1] \defgroup image_func_wrap wrap \ingroup image_mod_mat -Wrap takes an unwrapped image (see \ref unwrap) and converts it back to an image. +Wrap takes an unwrapped image (see \ref unwrap()) and converts it back to an image. The inputs to this function should be the same as the inputs used to generate the unwrapped image. @} diff --git a/docs/details/index.dox b/docs/details/index.dox new file mode 100644 index 0000000000..85386b25db --- /dev/null +++ b/docs/details/index.dox @@ -0,0 +1,19 @@ +/** +\addtogroup arrayfire_func +@{ + +\defgroup index_func_index index + +\brief lookup values on array based on sequences + +\ingroup index_mat + + + +\defgroup index_func_assign assign + +\brief Copy and write values in the locations specified by the sequences + +\ingroup index_mat +@} +*/ diff --git a/docs/details/lapack.dox b/docs/details/lapack.dox index ce23abe64a..c0d8aae5b9 100644 --- a/docs/details/lapack.dox +++ b/docs/details/lapack.dox @@ -140,7 +140,7 @@ The arrayfire function only returns the non zero diagonal elements of **S**. To \snippet test/svd_dense.cpp ex_svd_reg -When memory is a concern, and **A** is dispensible, \ref svdInPlace can be used +When memory is a concern, and **A** is dispensible, \ref svdInPlace() can be used ======================================================================= diff --git a/docs/details/util.dox b/docs/details/util.dox index 92ade02b7d..a0a81008e6 100644 --- a/docs/details/util.dox +++ b/docs/details/util.dox @@ -71,7 +71,7 @@ An file with 2 arrays would look like (representative) > Array 2 Dims\n > Array 2 Data\n -\ingroup stream_func +\ingroup dataio_mat \ingroup arrayfire_func ======================================================================= @@ -129,7 +129,7 @@ On each append, the array counter in the header is incremented and the new array is written to the end of the file. This function does not check if the tag is unique or not. -\ingroup stream_func +\ingroup dataio_mat \ingroup arrayfire_func ======================================================================= diff --git a/docs/doxygen.mk b/docs/doxygen.mk index 7e5f3778a7..defb7fe330 100644 --- a/docs/doxygen.mk +++ b/docs/doxygen.mk @@ -1978,7 +1978,8 @@ INCLUDE_FILE_PATTERNS = PREDEFINED = __declspec(x)= \ __attribute__(x)= \ __cplusplus \ - AF_DOC + AF_DOC \ + AF_API_VERSION=${AF_API_VERSION_CURRENT} # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/docs/pages/README.md b/docs/pages/README.md index 692ccc1816..0b69825d04 100644 --- a/docs/pages/README.md +++ b/docs/pages/README.md @@ -130,8 +130,7 @@ af_print(pi); ## Citations and Acknowledgements -If you redistribute ArrayFire, please follow the terms established in -[the license](LICENSE). +If you redistribute ArrayFire, please follow the terms established in the license. If you wish to cite ArrayFire in an academic publication, please use the following reference: @@ -156,5 +155,4 @@ year = {2015} } ``` -ArrayFire development is funded by ArrayFire LLC and several third parties, -please see the list of [acknowledgements](https://github.com/arrayfire/arrayfire/blob/master/ACKNOWLEDGEMENTS.md) for further details. +ArrayFire development is funded by ArrayFire LLC and several third parties, please see the list of acknowledgements. diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index e7287fea95..0ba0ae0049 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -7,10 +7,10 @@ v3.1.0 Function Additions ------------------ * Computer Vision Functions - * Nearest Neighbour with SAD, SSD and SHD distances (nearestNeighbour) - * Harris Corner Detector (harris) - * Susan Corner Detector (susan) - * Scale Invariant Feature Transform (SIFT) + * \ref nearestNeighbour() - Nearest Neighbour with SAD, SSD and SHD distances + * \ref harris() - Harris Corner Detector + * \ref susan() - Susan Corner Detector + * \ref sift() - Scale Invariant Feature Transform (SIFT) * Method and apparatus for identifying scale invariant features" "in an image and use of same for locating an object in an image,\" David" "G. Lowe, US Patent 6,711,293 (March 23, 2004). Provisional application" @@ -20,36 +20,50 @@ Function Additions "Columbia.") * SIFT is available for compiling but does not ship with ArrayFire hosted installers/pre-built libraries - * Difference of Gaussians (dog) + * \ref dog() - Difference of Gaussians * Image Processing Functions - * RGB <->YCbCr color space conversion (ycbcr2rgb, rgb2ycbcr) - * Wrap and Unwrap (wrap, unwrap) - * Summed Area Tables (sat) - * Load and Save images to/from memory (loadImageMem, saveImageMem) - * Add imageFormat (af_image_format) enum - -* Utility - * Allow users to set print precision (print, af_print_array_gen) - * Stream arrays to binary files (saveArray, readArray) - * toString function returns the array and data as a string + * \ref ycbcr2rgb() and \ref rgb2ycbcr() - RGB <->YCbCr color space conversion + * \ref wrap() and \ref unwrap() Wrap and Unwrap + * \ref sat() - Summed Area Tables + * \ref loadImageMem() and \ref saveImageMem() - Load and Save images to/from memory + * \ref af_image_format - Added imageFormat (af_image_format) enum * Array & Data Handling - * Copy (copy) - * Lock and Unlock (array::lock, array::unlock) - * Select and Replace (select, replace) + * \ref copy() - Copy + * array::lock() and array::unlock() - Lock and Unlock + * \ref select() and \ref replace() - Select and Replace * Get array reference count (af_get_data_ref_count) +* Signal Processing + * \ref fftInPlace() - 1D in place FFT + * \ref fft2InPlace() - 2D in place FFT + * \ref fft3InPlace() - 3D in place FFT + * \ref ifftInPlace() - 1D in place Inverse FFT + * \ref ifft2InPlace() - 2D in place Inverse FFT + * \ref ifft3InPlace() - 3D in place Inverse FFT + * \ref fftR2C() - Real to complex FFT + * \ref fftC2R() - Complex to Real FFT + +* Linear Algebra + * \ref svd() and \ref svdInPlace() - Singular Value Decomposition + * Other operations - * SVD Decomposition (svd) - * FFT - * Support for in place FFT - * Sigmoid (sigmoid) + * \ref sigmoid() - Sigmoid * Sum (with option to replace NaN values) * Product (with option to replace NaN values) * Graphics - * Window resizing using Forge API (Window::setSize) + * Window::setSize() - Window resizing using Forge API + +* Utility + * Allow users to set print precision (print, af_print_array_gen) + * \ref saveArray() and \ref readArray() - Stream arrays to binary files + * \ref toString() - toString function returns the array and data as a string + +* CUDA specific functionality + * \ref getStream() - Returns default CUDA stream ArrayFire uses for the current device + * \ref getNativeId() - Returns native id of the CUDA device Improvements ------------ @@ -60,18 +74,13 @@ Improvements * 64-bit integer support * For reductions, random, iota, range, diff1, diff2, accum, join, shift and tile -* sum and product - * Support for NaN value substitution * convolve * Support for non-overlapping batched convolutions * Complex Arrays * Fix binary ops on complex inputs of mixed types * Complex type support for exp -* FFT - * Support for r2c and c2r FFT - * Support for in place FFT * tile - * is now a JIT function + * Performance improvements by using JIT when possible. * Add AF_API_VERSION macro * Allows disabling of API to maintain consistency with previous versions * Other Performance Improvements @@ -123,9 +132,14 @@ Distribution Changes Known Issues ------------ -* OpenBlas can cause issues with QR +* OpenBlas can cause issues with QR factorization in CPU backend * FreeImage older than 3.10 can cause issues with loadImageMem and saveImageMem +* OpenCL backend issues on OSX + * AMD GPUs not supported because of driver issues + * Intel CPUs not supported + * Linear algebra functions do not work on Intel GPUs. +* Stability and correctness issues with open source OpenCL implementations such as Beignet, GalliumCompute. v3.0.2 ============== diff --git a/include/af/arith.h b/include/af/arith.h index d258e83704..4d3508d0d4 100644 --- a/include/af/arith.h +++ b/include/af/arith.h @@ -243,12 +243,15 @@ namespace af /// \param[in] lhs is real value(s) /// \param[in] rhs is imaginary value(s) /// \return complex array from inputs + /// \ingroup arith_func_cplx AFAPI array complex(const array &lhs, const array &rhs); /// \copydoc complex(const array&, const array&) + /// \ingroup arith_func_cplx AFAPI array complex(const array &lhs, const double rhs); /// \copydoc complex(const array&, const array&) + /// \ingroup arith_func_cplx AFAPI array complex(const double lhs, const array &rhs); /// C++ Interface for creating complex array from real array diff --git a/include/af/array.h b/include/af/array.h index b652d0456d..bdc6502208 100644 --- a/include/af/array.h +++ b/include/af/array.h @@ -802,8 +802,15 @@ namespace af ~array(); - // Transpose and Conjugate Tranpose + /// \brief Get the transposed the array + /// + /// \returns Transposed matrix + /// \ingroup method_mat array T() const; + /// \brief Get the conjugate-transpose of the current array + /// + /// \returns conjugate-transpose matrix + /// \ingroup method_mat array H() const; #define ASSIGN(OP) \ @@ -1093,7 +1100,7 @@ namespace af BIN_OP(operator||) /// @} - /// \ingroup numeric_func_mod + /// \ingroup arith_func_mod /// @{ /// \brief Performs an modulo operation on two arrays or an array and a value. /// diff --git a/include/af/cuda.h b/include/af/cuda.h index b3cf921fb4..7cc3cd6501 100644 --- a/include/af/cuda.h +++ b/include/af/cuda.h @@ -17,10 +17,28 @@ extern "C" { #endif #if AF_API_VERSION >= 31 +/** + Get the stream for the CUDA device with \p id in ArrayFire context + + \param[out] stream CUDA Stream of device with \p id in ArrayFire context + \param[in] id ArrayFire device id + \returns \ref af_err error code + + \ingroup cuda_mat + */ AFAPI af_err afcu_get_stream(cudaStream_t* stream, int id); #endif #if AF_API_VERSION >= 31 +/** + Get the native device id of the CUDA device with \p id in ArrayFire context + + \param[out] nativeid native device id of the CUDA device with \p id in ArrayFire context + \param[in] id ArrayFire device id + \returns \ref af_err error code + + \ingroup cuda_mat + */ AFAPI af_err afcu_get_native_id(int* nativeid, int id); #endif @@ -34,6 +52,14 @@ namespace afcu { #if AF_API_VERSION >= 31 +/** + Get the stream for the CUDA device with \p id in ArrayFire context + + \param[in] id ArrayFire device id + \returns cuda stream used by CUDA device + + \ingroup cuda_mat + */ static inline cudaStream_t getStream(int id) { cudaStream_t retVal; @@ -45,6 +71,14 @@ static inline cudaStream_t getStream(int id) #endif #if AF_API_VERSION >= 31 +/** + Get the native device id of the CUDA device with \p id in ArrayFire context + + \param[in] id ArrayFire device id + \returns cuda native id of device + + \ingroup cuda_mat + */ static inline int getNativeId(int id) { int retVal; diff --git a/include/af/data.h b/include/af/data.h index b2516a3844..bab14905d8 100644 --- a/include/af/data.h +++ b/include/af/data.h @@ -204,26 +204,16 @@ namespace af const dim_t d3, const dtype ty=f32); /** - \defgroup data_func_setseed setSeed - Set the seed for the random number generator - - \param[in] seed is a 64 bit unsigned integer - \ingroup data_mat - \ingroup arrayfire_func + \ingroup data_func_setseed */ AFAPI void setSeed(const uintl seed); /** - \defgroup data_func_getseed getSeed - Get the seed for the random number generator - - \returns seed which is a 64 bit unsigned integer - \ingroup data_mat - \ingroup arrayfire_func + \ingroup data_func_getseed */ AFAPI uintl getSeed(); @@ -654,26 +644,16 @@ extern "C" { AFAPI af_err af_randn(af_array *out, const unsigned ndims, const dim_t * const dims, const af_dtype type); /** - \defgroup data_func_setseed setSeed - Set the seed for the random number generator - - \param[in] seed is a 64 bit unsigned integer - \ingroup data_mat - \ingroup arrayfire_func + \ingroup data_func_setseed */ AFAPI af_err af_set_seed(const uintl seed); /** - \defgroup data_func_getseed getSeed - Get the seed for the random number generator - - \param[out] seed which is a 64 bit unsigned integer - \ingroup data_mat - \ingroup arrayfire_func + \ingroup data_func_getseed */ AFAPI af_err af_get_seed(uintl *seed); diff --git a/include/af/index.h b/include/af/index.h index 986e1a33c2..e3bb77b0fd 100644 --- a/include/af/index.h +++ b/include/af/index.h @@ -282,7 +282,7 @@ extern "C" { /// \param[in] indices is an af_array of \ref af_index_t objects /// \param[in] rhs is the array whose values will be assigned to \p lhs /// - /// \ingroup index_func_index + /// \ingroup index_func_assign /// AFAPI af_err af_assign_gen( af_array *out, const af_array lhs, diff --git a/include/af/opencl.h b/include/af/opencl.h index 467c4b9b21..c9f245e30a 100644 --- a/include/af/opencl.h +++ b/include/af/opencl.h @@ -19,12 +19,43 @@ extern "C" { #endif + /** + \ingroup opencl_mat + @{ + */ + /** + Get a handle to ArrayFire's OpenCL context + + \param[out] ctx the current context being used by ArrayFire + \param[in] retain if true calls clRetainContext prior to returning the context + \returns \ref af_err error code + + \note Set \p retain to true if this value will be passed to a cl::Context constructor + */ AFAPI af_err afcl_get_context(cl_context *ctx, const bool retain); + /** + Get a handle to ArrayFire's OpenCL command queue + + \param[out] queue the current command queue being used by ArrayFire + \param[in] retain if true calls clRetainCommandQueue prior to returning the context + \returns \ref af_err error code + + \note Set \p retain to true if this value will be passed to a cl::CommandQueue constructor + */ AFAPI af_err afcl_get_queue(cl_command_queue *queue, const bool retain); + /** + Get the device ID for ArrayFire's current active device + + \param[out] id the cl_device_id of the current device + \returns \ref af_err error code + */ AFAPI af_err afcl_get_device_id(cl_device_id *id); + /** + @} + */ #ifdef __cplusplus } #endif diff --git a/include/af/util.h b/include/af/util.h index 95cc1451e8..97e939e3e6 100644 --- a/include/af/util.h +++ b/include/af/util.h @@ -119,37 +119,6 @@ namespace af #define GET_PRINT_MACRO(_1, _2, NAME, ...) NAME -/** - Macro to print an array along with the variable name - - \param[in] exp the array to be printed - \param[in] precision (optional) is the number of decimal places to be printed - - \code - af::array myarray = randu(3, 3); - int myprecision = 2; - - af_print(myarray); // Defaults precision to 4 decimal places - // A [3 3 1 1] - // 0.0010 311.3614 1.6264 - // 60.3298 497.9737 359.5948 - // 165.4467 113.7310 5.2294 - - af_print(myarray, myprecision); // Uses myprecision decimal places - // A [3 3 1 1] - // 0.00 311.36 1.63 - // 60.33 497.97 359.59 - // 165.45 113.73 5.23 - - af_print(myarray, 6); // Uses 6 decimal places - // A [3 3 1 1] - // 0.001029 311.361402 1.626432 - // 60.329828 497.973728 359.594787 - // 165.446732 113.730984 5.229350 - \endcode - - \ingroup print_func_print -*/ #define af_print(...) GET_PRINT_MACRO(__VA_ARGS__, AF_PRINT2, AF_PRINT1)(__VA_ARGS__) #else @@ -189,7 +158,7 @@ extern "C" { #if AF_API_VERSION >= 31 /** \param[out] index is the index location of the array in the file - \param[in] key is an expression used as tag/key for the array during \ref readArray + \param[in] key is an expression used as tag/key for the array during \ref readArray() \param[in] arr is the array to be written \param[in] filename is the path to the location on disk \param[in] append is used to append to an existing file when true and create or diff --git a/include/af/vision.h b/include/af/vision.h index 5070d8c235..470a12d980 100644 --- a/include/af/vision.h +++ b/include/af/vision.h @@ -127,7 +127,7 @@ AFAPI void orb(features& feat, array& desc, const array& image, const float fast \ingroup cv_func_sift */ -AFAPI void sift(features& feat, array& desc, const array& in, const unsigned n_layers=3, const float contrast_thr=0.04f, const float edge_thr=10.f, const float init_sigma=1.6f, const bool double_input=true, const float img_scale=0.00390625f, const float feature_ratio=0.05f); +AFAPI void sift(features& feat, array& desc, const array& in, const unsigned n_layers=3, const float contrast_thr=0.04f, const float edge_thr=10.f, const float init_sigma=1.6f, const bool double_input=true, const float intensity_scale=0.00390625f, const float feature_ratio=0.05f); #endif /** @@ -365,7 +365,7 @@ extern "C" { \ingroup cv_func_sift */ - AFAPI af_err af_sift(af_features *feat, af_array *desc, const af_array in, const unsigned n_layers, const float contrast_thr, const float edge_thr, const float init_sigma, const bool double_input, const float img_scale, const float feature_ratio); + AFAPI af_err af_sift(af_features *feat, af_array *desc, const af_array in, const unsigned n_layers, const float contrast_thr, const float edge_thr, const float init_sigma, const bool double_input, const float intensity_scale, const float feature_ratio); #endif /** diff --git a/include/arrayfire.h b/include/arrayfire.h index c3d60223d2..2208bf5011 100644 --- a/include/arrayfire.h +++ b/include/arrayfire.h @@ -203,7 +203,7 @@ @defgroup external Interface Functions @{ - CUDA/OpenCL specific functions + Backend specific functions @defgroup opencl_mat OpenCL specific functions @@ -219,6 +219,14 @@ upload data to `cl_mem` objects from separate threads, but the thread which instantiated ArrayFire must do the `cl_mem` to \ref af::array conversion. + @defgroup cuda_mat CUDA specific functions + + \brief Accessing ArrayFire's stream, and native device id with other CUDA code. + + If your software is using ArrayFire's CUDA backend, you can also write custom + kernels and do custom memory operations using native CUDA commands. The functions + contained in the \p afcu namespace provide methods to get the stream and native + device id that ArrayFire is using. @} @} diff --git a/src/backend/opencl/platform.cpp b/src/backend/opencl/platform.cpp index 874832ea51..dd96d2eb30 100644 --- a/src/backend/opencl/platform.cpp +++ b/src/backend/opencl/platform.cpp @@ -246,8 +246,12 @@ std::string getInfo() (show_braces ? string("]") : "-"); info << id << " " << platformMap(platStr) << ": " << ltrim(dstr) << " "; #ifndef NDEBUG - info << device.getInfo(); - info << " Device driver " << device.getInfo(); + string devVersion = device.getInfo(); + string driVersion = device.getInfo(); + devVersion.pop_back(); + driVersion.pop_back(); + info << devVersion; + info << " Device driver " << driVersion; info << " FP64 Support(" << (device.getInfo()>0 ? "True" : "False") << ")";