view example/multiply/ppe/Multi.cc @ 1561:e8c9a7099bcc draft

add set NDRange param
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Tue, 12 Mar 2013 16:52:49 +0900
parents f71632373220
children d8f25aa30cac
line wrap: on
line source

#include <stdio.h>
#include "SchedTask.h"
#include "Multi.h"
#include "Func.h"
#include "GpuScheduler.h"

/* これは必須 */
SchedDefineTask(Multiply);

static int
run(SchedTask *s,void *rbuf, void *wbuf)
{
    float *A,*B,*C;

    A = (float*)s->get_input(rbuf, 0);
    B = (float*)s->get_input(rbuf, 1);
    C = (float*)s->get_output(wbuf, 0);

    long length = (long)s->get_param(1);
    for (int i=0; i<length; i++) {
        C[i]=A[i]*B[i];
    }
    
    return 0;
}