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

cblas_dtrsm crashes on I7 running ubuntu 9.10 64 bit

hagai_sela
Beginner
828 Views
Hi,
The attached code crashes on my core I7 machine which runs ubuntu 9.10 64 bits.
[cpp]#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;

#define NUM_ITEMS 1
#define NUM_WEIGHTS 100
#define NUM_OUTPUTS 25
#define NUM_CYCLES 50

void PrintMatrix(double* pMatrix, const size_t nRows, const size_t nCols)
{
    for (size_t i=0; i<< pMatrix[i * nCols + j] << 't';
        }
        cout << endl;
    }
    cout << endl;
}

void PrintLowerTriangularMatrix(double* pMatrix, const size_t nRowCols)
{
    for (size_t i=0; i<=i; ++j)
        {
            cout << pMatrix[i * nRowCols + j] << 't';
        }
        cout << endl;
    }
    cout << endl;
}

void CreatePascalMatrix(double* const pMatrix, const int nWidthHeight)
{
    for (int i=0; i<< "P:" << endl;
    PrintMatrix(P, NUM_WEIGHTS, NUM_OUTPUTS);

    int nNumOutputs = NUM_OUTPUTS;
    char chUplo = 'L';
    int nInfo;

    CreatePascalMatrix(S, NUM_OUTPUTS);
    cout << "S:" << endl;
    PrintMatrix(S, NUM_OUTPUTS, NUM_OUTPUTS);

    dpotrf(
        &chUplo,
        &nNumOutputs,
        S,
        &nNumOutputs,
        &nInfo);

    cout << "S Cholesky:" << endl;
    PrintLowerTriangularMatrix(S, NUM_OUTPUTS);

    cblas_dtrsm(CblasRowMajor, CblasRight, CblasLower, CblasTrans, CblasNonUnit, NUM_WEIGHTS, NUM_OUTPUTS, 1, S, NUM_OUTPUTS, P, NUM_WEIGHTS);

    cout << "X:" << endl;
    PrintMatrix(P, NUM_WEIGHTS, NUM_OUTPUTS);

    // multiply to check result
    cblas_dtrmm(CblasRowMajor, CblasRight, CblasLower, CblasTrans, CblasNonUnit, NUM_WEIGHTS, NUM_OUTPUTS, 1, S, NUM_OUTPUTS, P, NUM_WEIGHTS);

    cout << "P:" << endl;
    PrintMatrix(P, NUM_WEIGHTS, NUM_OUTPUTS);
}

int main()
{
    CalculateGain();
    return 0;
}



[/cpp]

Hagai.
0 Kudos
4 Replies
Gennady_F_Intel
Moderator
828 Views

hagai,
at the first glancethis code isn't compiled:

- for(size_ti=0;i<}
- the same with PrintLowerTriangularMatrix ..
- CalculateGain() ????
How the input Matrixinitialized?
Can you create thefull version of the test(plus the input data ) and attach it to this thread?
--Gennady

0 Kudos
hagai_sela
Beginner
828 Views
OK, so this is another bug in your code editor... I pasted my code into the forum's code editor after compiling it and it changed it to the version you see above. I'll attach it as a file, you can paste from the attached file and see that it happens.

There is no additional data... the input matrix to dtrsm is a cholesky factor of a pascal matrix, initialized by the CreatePascalMatrix function.

Hagai.
0 Kudos
Gennady_F_Intel
Moderator
828 Views
Quoting - hagai_sela
OK, so this is another bug in your code editor... I pasted my code into the forum's code editor after compiling it and it changed it to the version you see above. I'll attach it as a file, you can paste from the attached file and see that it happens.

There is no additional data... the input matrix to dtrsm is a cholesky factor of a pascal matrix, initialized by the CreatePascalMatrix function.

Hagai.

allocating the output array by the following
//double P[NUM_WEIGHTS * NUM_OUTPUTS];
double P[NUM_WEIGHTS * NUM_WEIGHTS];
eliminates the problem
--Gennady
0 Kudos
hagai_sela
Beginner
828 Views

allocating the output array by the following
//double P[NUM_WEIGHTS * NUM_OUTPUTS];
double P[NUM_WEIGHTS * NUM_WEIGHTS];
eliminates the problem
--Gennady

a - I increased the array size to NUM_WEIGHTS * NUM_WEIGHTS, and it still crashes.
b - I am not sure I follow... Are you suggesting this as a workaround or a bug fix?
The equation is XA=B.
A is a NUM_OUTPUTS * NUM_OUTPUTS matrix, B is a NUM_WEIGHTS * NUM_OUTPUTS matrix, therefore X should also be a NUM_WEIGHTS * NUM_OUTPUTS matrix.

Hagai.
0 Kudos
Reply