Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
Thread Tools  Search this thread 
hagai_sela
Total Points:
230
Status Points:
180
Green Belt
November 1, 2009 1:25 PM PST
cblas_dtrsm crashes on I7 running ubuntu 9.10 64 bit
Hi,
The attached code crashes on my core I7 machine which runs ubuntu 9.10 64 bits.
#include <iostream>
#include <mkl.h>
#include <mkl_cblas.h>
#include <mkl_lapack.h>
#include <assert.h>
#include <math.h>
#include <string.h>
#include <malloc.h>
#include <sys/time.h>

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;
}




Hagai.
Gennady Fedorov (Intel)
Total Points:
13,046
Status Points:
12,546
Brown Belt
November 1, 2009 10:13 PM PST
Rate
 
#1

hagai,
at the first glance this code isn't compiled:

- for (size_t i=0; i<< pMatrix[i * nCols + j] << '\t';  
       }  
- the same with PrintLowerTriangularMatrix ..
- CalculateGain() ????
How the input Matrix initialized?
Can you create the full version of the test (plus the input data ) and attach it to this thread?
--Gennady

 



hagai_sela
Total Points:
230
Status Points:
180
Green Belt
November 2, 2009 12:31 AM PST
Rate
 
#2 Reply to #1
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.


 Attachments 
Gennady Fedorov (Intel)
Total Points:
13,046
Status Points:
12,546
Brown Belt
November 6, 2009 2:17 AM PST
Rate
 
#3 Reply to #2
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


hagai_sela
Total Points:
230
Status Points:
180
Green Belt
November 6, 2009 1:02 PM PST
Rate
 
#4 Reply to #3

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.




Intel Software Network Forums Statistics

8492 users have contributed to 31630 threads and 100774 posts to date.
In the past 24 hours, we have 27 new thread(s) 122 new posts(s), and 166 new user(s).

In the past 3 days, the most popular thread for everyone has been Implicite multithreading ??? The most posts were made to Crash when loading skeleton The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member mdward