Convey vector example

From Cpre584
Revision as of 22:14, 1 February 2012 by Ktown (talk | contribs)
Jump to navigation Jump to search

Note we are having difficulty running this example

Convey allows you to write c/c++ or fortran code that is compiled to run on the co-processor. This is done by changing loops into vector opererations. Below is an example of a function that can be compiled to run with the co-processor

void SimpleVectorAdder(int x[], int y[], int n){
    int i;
#pragma cny begin_coproc
    for(i = 0; i < n; i++){
        x[i] = x[i] + y[i];
    }
#pragma cny end_coproc
}

or

void SimpleVectorAdder(int x[], int y[], int n){
#pragma cny dual_target
    int i;
    for(i = 0; i < n; i++){
        x[i] = x[i] + y[i];
    }
}