GithubHelp home page GithubHelp logo

androidcl's Introduction

ArrayFire is a general-purpose tensor library that simplifies the software development process for the parallel architectures found in CPUs, GPUs, and other hardware acceleration devices. The library serves users in every technical computing market.

Several of ArrayFire's benefits include:

  • Hundreds of accelerated tensor computing functions, in the following areas:
    • Array handling
    • Computer vision
    • Image processing
    • Linear algebra
    • Machine learning
    • Standard math
    • Signal Processing
    • Statistics
    • Vector algorithms
  • Easy to use, stable, well-documented API
  • Rigorous benchmarks and tests ensuring top performance and numerical accuracy
  • Cross-platform compatibility with support for CUDA, oneAPI, OpenCL, and native CPU on Windows, Mac, and Linux
  • Built-in visualization functions through Forge
  • Commercially friendly open-source licensing
  • Enterprise support from ArrayFire

ArrayFire provides software developers with a high-level abstraction of data that resides on the accelerator, the af::array object. Developers write code that performs operations on ArrayFire arrays, which, in turn, are automatically translated into near-optimal kernels that execute on the computational device.

ArrayFire runs on devices ranging from low-power mobile phones to high-power GPU-enabled supercomputers. ArrayFire runs on CPUs from all major vendors (Intel, AMD, ARM), GPUs from the prominent manufacturers (AMD, Intel, NVIDIA, and Qualcomm), as well as a variety of other accelerator devices on Windows, Mac, and Linux.

Getting ArrayFire

Instructions to install or to build ArrayFire from source can be found on the wiki.

Conway's Game of Life Using ArrayFire

Visit the Wikipedia page for a description of Conway's Game of Life.

Conway's Game of Life

static const float h_kernel[] = { 1, 1, 1, 1, 0, 1, 1, 1, 1 };
static const array kernel(3, 3, h_kernel, afHost);

array state = (randu(128, 128, f32) > 0.5).as(f32); // Init state
Window myWindow(256, 256);
while(!myWindow.close()) {
    array nHood = convolve(state, kernel); // Obtain neighbors
    array C0 = (nHood == 2);  // Generate conditions for life
    array C1 = (nHood == 3);
    state = state * C0 + C1;  // Update state
    myWindow.image(state);    // Display
}

The complete source code can be found here.

Perceptron

Perceptron

array predict(const array &X, const array &W) {
    return sigmoid(matmul(X, W));
}

array train(const array &X, const array &Y,
        double alpha = 0.1, double maxerr = 0.05,
        int maxiter = 1000, bool verbose = false) {
    array Weights = constant(0, X.dims(1), Y.dims(1));

    for (int i = 0; i < maxiter; i++) {
        array P   = predict(X, Weights);
        array err = Y - P;
        if (mean<float>(abs(err) < maxerr) break;
        Weights += alpha * matmulTN(X, err);
    }
    return Weights;
}
...

array Weights = train(train_feats, train_targets);
array test_outputs  = predict(test_feats, Weights);
display_results<true>(test_images, test_outputs,
                      test_targets, 20);

The complete source code can be found here.

For more code examples, visit the examples/ directory.

Documentation

You can find the complete documentation here.

Quick links:

Language support

ArrayFire has several official and community maintained language API's:

C++ Python Rust Julia Nim

  Community maintained wrappers

In-Progress Wrappers

.NET Fortran Go Java Lua NodeJS R Ruby

Contributing

The community of ArrayFire developers invites you to build with us if you are interested and able to write top-performing tensor functions. Together we can fulfill The ArrayFire Mission for fast scientific computing for all.

Contributions of any kind are welcome! Please refer to the wiki and our Code of Conduct to learn more about how you can get involved with the ArrayFire Community through Sponsorship, Developer Commits, or Governance.

Citations and Acknowledgements

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 citation document.

ArrayFire development is funded by AccelerEyes LLC and several third parties, please see the list of acknowledgements for an expression of our gratitude.

Support and Contact Info

Trademark Policy

The literal mark "ArrayFire" and ArrayFire logos are trademarks of AccelerEyes LLC (dba ArrayFire). If you wish to use either of these marks in your own project, please consult ArrayFire's Trademark Policy

androidcl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

androidcl's Issues

Libopencl.so compile error

we try to build saple code but we get below error

./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cb(_cl_program*, void*)': /home/einfochips/androidcl/jni/processor.cpp:59: undefined reference to clRetainProgram'
/home/einfochips/androidcl/jni/processor.cpp:61: undefined reference to clGetProgramInfo' /home/einfochips/androidcl/jni/processor.cpp:63: undefined reference to clGetProgramBuildInfo'
/home/einfochips/androidcl/jni/processor.cpp:64: undefined reference to clReleaseProgram' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_context*>::release(_cl_context*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1090: undefined reference to clReleaseContext' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_command_queue*>::release(_cl_command_queue*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1099: undefined reference to clReleaseCommandQueue' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_kernel*>::release(_cl_kernel*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1135: undefined reference to clReleaseKernel' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::Program::Program(cl::Context const&, std::__ndk1::vector<std::__ndk1::pair<char const*, unsigned long>, std::__ndk1::allocator<std::__ndk1::pair<char const*, unsigned long> > > const&, int*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:2603: undefined reference to clCreateProgramWithSource' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_program*>::release(_cl_program*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1126: undefined reference to clReleaseProgram' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::Buffer::Buffer(cl::Context const&, unsigned long, unsigned long, void*, int*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1855: undefined reference to clCreateBuffer' /home/einfochips/androidcl/jni/include/CL/cl.hpp:1855: undefined reference to clCreateBuffer'
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1855: undefined reference to clCreateBuffer' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function int cl::Kernel::setArg(unsigned int, int)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:2553: undefined reference to clSetKernelArg' /home/einfochips/androidcl/jni/include/CL/cl.hpp:2553: undefined reference to clSetKernelArg'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_mem*>::retain(_cl_mem*)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:1106: undefined reference to clRetainMemObject'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function int cl::Kernel::setArg<cl::Buffer>(unsigned int, cl::Buffer)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:2553: undefined reference to clSetKernelArg'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_mem*>::release(_cl_mem*)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:1108: undefined reference to clReleaseMemObject'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_mem*>::retain(_cl_mem*)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:1106: undefined reference to clRetainMemObject'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function int cl::Kernel::setArg<cl::Buffer>(unsigned int, cl::Buffer)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:2553: undefined reference to clSetKernelArg'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_mem*>::release(_cl_mem*)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:1108: undefined reference to clReleaseMemObject'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::CommandQueue::enqueueNDRangeKernel(cl::Kernel const&, cl::NDRange const&, cl::NDRange const&, cl::NDRange const&, std::__ndk1::vector<cl::Event, std::__ndk1::allocator<cl::Event> > const*, cl::Event*) const': /home/einfochips/androidcl/jni/include/CL/cl.hpp:3256: undefined reference to clEnqueueNDRangeKernel'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function int cl::Kernel::setArg<int>(unsigned int, int)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:2553: undefined reference to clSetKernelArg'
/home/einfochips/androidcl/jni/include/CL/cl.hpp:2553: undefined reference to clSetKernelArg' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_mem*>::retain(_cl_mem*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1106: undefined reference to clRetainMemObject' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function int cl::Kernel::setArgcl::Buffer(unsigned int, cl::Buffer)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:2553: undefined reference to clSetKernelArg' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_mem*>::release(_cl_mem*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1108: undefined reference to clReleaseMemObject' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_mem*>::retain(_cl_mem*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1106: undefined reference to clRetainMemObject' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function int cl::Kernel::setArgcl::Buffer(unsigned int, cl::Buffer)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:2553: undefined reference to clSetKernelArg' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_mem*>::release(_cl_mem*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1108: undefined reference to clReleaseMemObject' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::CommandQueue::enqueueNDRangeKernel(cl::Kernel const&, cl::NDRange const&, cl::NDRange const&, cl::NDRange const&, std::__ndk1::vector<cl::Event, std::__ndk1::allocatorcl::Event > const*, cl::Event*) const':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:3256: undefined reference to clEnqueueNDRangeKernel' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::CommandQueue::enqueueReadBuffer(cl::Buffer const&, unsigned int, unsigned long, unsigned long, void*, std::__ndk1::vector<cl::Event, std::__ndk1::allocatorcl::Event > const*, cl::Event*) const':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:2859: undefined reference to clEnqueueReadBuffer' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_mem*>::release(_cl_mem*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1108: undefined reference to clReleaseMemObject' /home/einfochips/androidcl/jni/include/CL/cl.hpp:1108: undefined reference to clReleaseMemObject'
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1108: undefined reference to clReleaseMemObject' /home/einfochips/androidcl/jni/include/CL/cl.hpp:1108: undefined reference to clReleaseMemObject'
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1108: undefined reference to clReleaseMemObject' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o:/home/einfochips/androidcl/jni/include/CL/cl.hpp:1108: more undefined references to clReleaseMemObject' follow
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::Platform::get(std::__ndk1::vector<cl::Platform, std::__ndk1::allocator<cl::Platform> >*)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:1473: undefined reference to clGetPlatformIDs'
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1480: undefined reference to clGetPlatformIDs' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::Context::Context(unsigned long, long*, void ()(char const, void const*, unsigned long, void*), void*, int*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1535: undefined reference to clCreateContextFromType' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_context*>::release(_cl_context*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1090: undefined reference to clReleaseContext' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_context*>::retain(_cl_context*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1088: undefined reference to clRetainContext' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_context*>::release(_cl_context*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1090: undefined reference to clReleaseContext' ./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function int cl::detail::getInfo<int ()(_cl_context, unsigned int, unsigned long, void*, unsigned long*), _cl_context*, std::__ndk1::vector<cl::Device, std::__ndk1::allocatorcl::Device > >(int ()(_cl_context, unsigned int, unsigned long, void*, unsigned long*), _cl_context* const&, unsigned int, std::__ndk1::vector<cl::Device, std::__ndk1::allocatorcl::Device >*)':
/home/einfochips/androidcl/jni/include/CL/cl.hpp:1046: undefined reference to clGetContextInfo' /home/einfochips/androidcl/jni/include/CL/cl.hpp:1046: undefined reference to clGetContextInfo'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::CommandQueue::CommandQueue(cl::Context const&, cl::Device const&, unsigned long, int*)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:2792: undefined reference to clCreateCommandQueue'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_command_queue*>::release(_cl_command_queue*)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:1099: undefined reference to clReleaseCommandQueue'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_command_queue*>::retain(_cl_command_queue*)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:1097: undefined reference to clRetainCommandQueue'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::detail::ReferenceHandler<_cl_command_queue*>::release(_cl_command_queue*)': /home/einfochips/androidcl/jni/include/CL/cl.hpp:1099: undefined reference to clReleaseCommandQueue'
./obj/local/arm64-v8a/objs/JNIProcessor/processor.o: In function cl::Program::build(std::__ndk1::vector<cl::Device, std::__ndk1::allocator<cl::Device> > const&, char const*, void (*)(_cl_program*, void*), void*) const': /home/einfochips/androidcl/jni/include/CL/cl.hpp:2676: undefined reference to clBuildProgram'

It look like CL lib did n't' link properly .

Please guide us if we miss something on above issue.

build failed

I followed instruction and passed "ndk-build" ,next I want to run the demo on my device.should i run the "ant debug build" in the root directory?
image

Looking forward to your patronage!

OpenCL library no provided

Hi, today I tried to buidl the project following your instructions but the ndk-build command return me this error:

iago@iago-S551LB:~/Escritorio/OpenCL/androidcl$ ndk-build
Android NDK: WARNING:jni/Android.mk:JNIProcessor: non-system libraries in linker flags: jni/libs/libOpenCL.so    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
[armeabi] Compile++ arm  : JNIProcessor <= processor.cpp
[armeabi] SharedLibrary  : libJNIProcessor.so
arm-linux-androideabi-g++: error: jni/libs/libOpenCL.so: No such file or directory
make: *** [obj/local/armeabi/libJNIProcessor.so] Error 1

I think the problem is that you do not provide the needed OpenCL library.

jni/libs/libOpenCL.so: error adding symbols: File in wrong format

Hi,
I have generated libOpenCL.so by running the following command in windows 10

C:\Users\H242018\AppData\Local\Android\sdk\platform-tools>adb pull /system/vendor/lib/libOpenCL.so ./
/system/vendor/lib/libOpenCL.so: 1 file pulled. 0.6 MB/s (75924 bytes in 0.120s)

I copied the generated file and pasted in jni/libs folder of androidcl project and ran the following command

C:\Users\H242018\Downloads\androidcl-master\androidcl-master>ndk-build
Android NDK: WARNING:jni/Android.mk:JNIProcessor: non-system libraries in linker flags: jni/libs/libOpenCL.so
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:jni/Android.mk:JNIProcessor: non-system libraries in linker flags: jni/libs/libOpenCL.so
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:jni/Android.mk:JNIProcessor: non-system libraries in linker flags: jni/libs/libOpenCL.so
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:jni/Android.mk:JNIProcessor: non-system libraries in linker flags: jni/libs/libOpenCL.so
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:jni/Android.mk:JNIProcessor: non-system libraries in linker flags: jni/libs/libOpenCL.so
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:jni/Android.mk:JNIProcessor: non-system libraries in linker flags: jni/libs/libOpenCL.so
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
Android NDK: WARNING:jni/Android.mk:JNIProcessor: non-system libraries in linker flags: jni/libs/libOpenCL.so
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
[arm64-v8a] SharedLibrary : libJNIProcessor.so
jni/libs/libOpenCL.so: error adding symbols: File in wrong format
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/arm64-v8a/libJNIProcessor.so] Error 1

C:\Users\H242018\Downloads\androidcl-master\androidcl-master>

I am getting jni/libs/libOpenCL.so: error adding symbols: File in wrong format as seen above. Kindly help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.