Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

mkl_somatadd does nothing

ddavobsc
Beginner
112 Views

Perhaps I am not understanding correctly how it should be used, but mkl_?omatadd is not working for me.

I have tried with this test:

    auto A = new float[4] {1,2,3,4};
    auto B = new float[4] {1,2,3,4};
    auto C = new float[4] {-1,-1,-1,-1};
    auto E = new float[4] {2,4,6,8};

    mkl_somatadd(
        CblasRowMajor,
        CblasNoTrans,
        CblasNoTrans,
        2, 2,
        1.0, A, 2,
        1.0, B, 2,
        C, 2
    );
    ASSERT_THAT(
        std::vector<float>(A, A+2*2),
        testing::Pointwise(testing::FloatEq(), std::vector<float>(E, E+4))
    );

The C  matrix is not modified at all. After going through mkl_somatadd, C is still {-1, -1, -1, -1}

0 Kudos
1 Reply
Fengrui
Moderator
28 Views

Hi,

 

Were there any errors captured by oneMKL error handler?

It might be caused by the wrong setting of the first three parameters. I tried 

    mkl_somatadd(
        'R',
        'N',
        'N',
        2, 2,
        1.0, A, 2,
        1.0, B, 2,
        C, 2
    );

 and got C={2, 4, 6, 8}.

 

Thanks,

Fengrui

0 Kudos
Reply