This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Does gcc cilk plus support include offloading to graphics hardware?

Release notes say:
"Full support for Cilk Plus has been added to the GCC compiler. Cilk
Plus is an extension to the C and C++ languages to support data and
task parallelism."

gcc-5.2 (centos-7, devtoolset-4) says:

g++ -std=c++14 -Wall -O3 -march=native -fcilkplus vec_add.cpp -o vec_add
vec_add.cpp:6:0: warning: ignoring #pragma offload target [-Wunknown-pragmas]
 #pragma offload target(gfx) pin(out, in1, in2 : length(n))



#include <iostream>
#include <cilk/cilk.h>

void vec_add(int n, float *out, float *in1, float *in2)
#pragma offload target(gfx) pin(out, in1, in2 : length(n))
    cilk_for(int i = 0; i != n; ++i)
        out[i] = in1[i] + in2[i];

static int ar_sz = 100000;
int main (int argc, char **argv)
    float foo[ar_sz];
    float bar[ar_sz];
    float out[ar_sz];
    for(int i = 0; i != ar_sz; ++i)
        foo[i] = i + ar_sz * 10;
        bar[i] = i;
    vec_add(ar_sz, out, foo, bar);

    for(int i = 0; i != ar_sz; i += 100)
        std::cout << "foo[" << i << "] =" << foo[i] << "\t|\tbar[" <<
i << "] =" <<  bar[i] << std::endl;

Compiled with

FLAGS=-std=c++14 -Wall -O3 -march=native -fcilkplus

all: vec_add fib

vec_add: vec_add.cpp
    g++ $(FLAGS) $< -o $@

$gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--with-bugurl= --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --enable-plugin --with-linker-hash-style=gnu
--enable-initfini-array --disable-libgcj
--enable-libmpx --enable-gnu-indirect-function --with-tune=generic
--with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 5.2.1 20150902 (Red Hat 5.2.1-2) (GCC)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]