Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating point exception(core dumped) #3

Open
wub11 opened this issue Apr 26, 2020 · 0 comments
Open

Floating point exception(core dumped) #3

wub11 opened this issue Apr 26, 2020 · 0 comments

Comments

@wub11
Copy link

wub11 commented Apr 26, 2020

Hi,
I tried a simple convolution code but got this:

./run.sh: line 41:  5460 Floating point exception(core dumped) $opcodegen $finalnode $edge $llvmnode $llvmedge $obj prolog.sch kernel.sch epilog.sch $X $Y $R $liveoutnode $liveoutedge > cgra_instructions.txt

Simple convolution code:

#include <stdlib.h>
#include <stdio.h>

#define kernelSize 2
#define inputSize 50

int count = 0;
int *convolve(int input[inputSize][inputSize], int filter[kernelSize][kernelSize])
{
    int output[inputSize-kernelSize+1][inputSize-kernelSize+1];
    for (int i = 0; i < inputSize-kernelSize+1; i++)
        for (int j = 0; j < inputSize-kernelSize+1; j++)
            output[i][j] = 0;
    for (int oj = 0; oj < inputSize-kernelSize+1; oj++)
    {
    #pragma CGRA
        for (int oi = 0; oi < inputSize-kernelSize+1; oi++)
        {
            output[oi][oj] += input[oi + 0][oj + 0] * filter[0][0];
            output[oi][oj] += input[oi + 0][oj + 1] * filter[0][1];
            output[oi][oj] += input[oi + 1][oj + 0] * filter[1][0];
            output[oi][oj] += input[oi + 1][oj + 1] * filter[1][1];
        }
    }
    for (int oj = 0; oj < inputSize-kernelSize+1; oj++)
    {
        for (int oi = 0; oi < inputSize-kernelSize+1; oi++)
        {
            printf("%d \n",output[oi][oj]);
        }
    }
}
int main(int argc, char *argv[])
{
    int h[inputSize][inputSize];
    for (int i = 0; i < inputSize; i++)
        for (int j = 0; j < inputSize; j++)
            h[i][j] = i*j;
    int z[kernelSize][kernelSize] = {{1, 2}, {1, 2}};

    convolve(h, z);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant