A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.arrayfire.org/docs/unified_2basic_8cpp-example.htm below:

ArrayFire: unified/basic.cpp

#include <algorithm>

#include <cstdio>

#include <vector>

std::vector<float> input(100);

double unifRand() { return rand() / double(RAND_MAX); }

void testBackend() {

}

int main(int, char**) {

std::generate(input.begin(), input.end(), unifRand);

try {

printf("Trying CPU Backend\n");

testBackend();

printf("Caught exception when trying CPU backend\n");

fprintf(stderr,

"%s\n"

, e.

what

());

}

try {

printf("Trying CUDA Backend\n");

testBackend();

printf("Caught exception when trying CUDA backend\n");

fprintf(stderr,

"%s\n"

, e.

what

());

}

try {

printf("Trying OpenCL Backend\n");

testBackend();

printf("Caught exception when trying OpenCL backend\n");

fprintf(stderr,

"%s\n"

, e.

what

());

}

return 0;

}

A multi dimensional data container.

Generic object that represents size and shape.

An ArrayFire exception class.

virtual const char * what() const

Returns an error message for the exception in a string format.

@ f32

32-bit floating point values

@ AF_BACKEND_CUDA

CUDA Compute Backend.

@ AF_BACKEND_OPENCL

OpenCL Compute Backend.

@ AF_BACKEND_CPU

CPU a.k.a sequential algorithms.

array constant(T val, const dim4 &dims, const dtype ty=(af_dtype) dtype_traits< T >::ctype)

C++ Interface to generate an array with elements set to a specified value.

AFAPI void setBackend(const Backend bknd)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4