MPL license를 사용하는 armadillo에 비해, ArrayFire는 BSD license를 사용하므로 상용 제품에 대한 프로그래밍에도 적합하다. Armadillo를 이용해서 상용 제품을 만드려면, 라이센스를 구입해야 한다.
MPL license
What is the license for Armadillo ?
Armadillo is available under two licenses:
ArrryFire가 BSD license라는 것에 대한 안내
http://arrayfire.com/arrayfire-is-now-open-source/
ArrayFire is being released under the BSD 3-Clause License, which will enable unencumbered deployment and portability of ArrayFire for commercial use.
Interoperability with CUDA
cuda native code를 사용하고 싶을 때 ArrayFire에서 연 stream의 id를 받아 같은 stream에서 작동하게 하는 방법.
http://arrayfire.org/docs/interop_cuda.htm
1. ArrayFire, Armadillo fft 속도 비교
> comparison_speed_AF_arma_nativeCpp.exe
ArrayFire v3.3.2 (OpenCL, 64-bit Windows, build f65dd97)
[0] NVIDIA : GeForce GTX TITAN Black, 6144 MB
-1- INTEL : Intel(R) HD Graphics 4600, 1425 MB
-2- INTEL : Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz, 16299 MB
-3- Experimental OpenCL 2.0 CPU Only Platform: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz, 16299 MB
elapsed seconds: 0.553387
ArrayFire v3.3.2 (CUDA, 64-bit Windows, build f65dd97)
Platform: CUDA Toolkit 7.5, Driver: CUDA Driver Version: 7050
[0] GeForce GTX TITAN Black, 6144 MB, CUDA Compute 3.5
elapsed seconds: 1.0508
ArrayFire v3.3.2 (CPU, 64-bit Windows, build f65dd97)
[0] Unknown: Unknown, 16299 MB, Max threads(1)
elapsed seconds: 0.727135
armadillo:
elapsed seconds: 1.932
2. Benchmarking parallel vector libraries
http://arrayfire.com/benchmarking-parallel-vector-libraries/
참고
http://www.hnagata.net/archives/576
Build arrayfire using cmake on macbook air
ArrayFire를 사용할 때 주의할 점
int main(void) { array A = randu(16, 3, f32); array B = randu(16, 3, f32);
// 원래 matrix의 row길이가 같지 않은 array는 gfor에서 column으로 표현된다 해도 붙일 수 없다. gfor(seq i, 3) array B(span, i) = fft(A(span, i)); // ERROR! array C = randu(16, 3, c32); // complex float array gfor(seq i, 3) array C(span, i) = fft(A(span, i)); // OK! return 0; } |
int main(void) { array A = randu(4, 3);
// 원래 matrix의 row길이가 같지 않은 array는 gfor에서 column으로 표현된다 해도 붙일 수 없다. gfor(seq i, 3) array B = join(0, A(span, i), constant(0, 1, 3)); // ERROR! array C = randu(2, 3); // 원래 matrix의 row길이가 같은 array끼리만 붙일 수 있다. gfor(seq i, 3) array B = join(0, A(span, i), C(span, i)); // OK!
return 0; } |
int main(void) { array A = randu(4, 3); // 4x3 matrix에서 각 column을 2x2 matrix로 reshaping하여 다시 사용하고 싶을 경우 gfor(seq i, 3) array B = array(A(span, i), 2, 2); // ERROR!
return 0; } |
int main(void) { float* h_inds[] = {0, 1, 2, 3}; array inds = array(4, 1, h_inds, afHost); array A = randu(4, 4); // 4x4 matrix에서 각 column을 indices에 따라 다시 새로운 array로 받고 싶을 때 gfor(seq i, 4) { array B = A(span, i); array C = B(inds); // ERROR! }
return 0; } |