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

Complex lu factorization (cgetrf) does not work, but real version (sgetrf) does.

Randy_Cox
Beginner
170 Views

I can get sgetrf working, but when I do the exact call with cgetrf, it does not work (Info = 2).

I double checked all the data structures and parameters.
Here is my simple test code that I used for both sgetrf and cgetrf.
Does anybody notice where I may have made my mistake?


float b2[] = {

1 ,0, 0,

0, 1, 0,

0, 0, 1

};

MKL_Complex8 b[] = {

{1, 0}, {0, 0}, {0, 0},

{0, 0}, {1, 0}, {0, 0},

{0, 0}, {0, 0}, {1, 0},

};

int n = 3;

int lda = 3;

int ldb = 3;

int ipiv[3];

int info = 0;

char trans = 'N';

float *buff2 = malloc(sizeof(float) * n * n);

MKL_Complex8 *buff = malloc(sizeof(MKL_Complex8) * n * n);

memcpy(buff2, b2, sizeof(float)*n*n);

memcpy(buff, b, sizeof(MKL_Complex8)*n*n);

sgetrf( &n, &n, buff2, &lda, &ipiv, &info );

cgetrf( &n, &n, buff, &lda, &ipiv, &info );



=========================
I get the following results:

buff2 = 1 01
0 1 0
0 0 1
info = 0

so sgetrf worked with real values


buff = 1+0i 0+0i 0+0i
-1.#IO-1.#IOI -1.#IO-1.#IOI -1.#IO-1.#IOI
-1.#IO-1.#IOI -1.#IO-1.#IOI -1.#IO-1.#IOI
info = 2

but cgetrf did not work.


Thanks in advance for anyone that may be able to spot the problem.
I'm new to MKL and am still trying to get my arms around the parameter data structures.

Thanks,
Randy

0 Kudos
1 Solution
Gennady_F_Intel
Moderator
170 Views
Randy,

May I ask you to do some more steps in hope to find the problem?
1) to check the problem with the separate project link only MKL?
The linking dependencies are the same you used : mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

2) with the same standalone project to use serial versions:
sequential.lib mkl_intel_c.lib mkl_sequential.lib mkl_core.lib

--Gennady

View solution in original post

6 Replies
Gennady_F_Intel
Moderator
170 Views

Randy,
I checked the problem you reported on win32 with MKL version10.2.
Please the output result I ve got, below

sgetrf: info == 0
buff2 1.000000, 0.000000, 0.000000
buff2 0.000000, 1.000000, 0.000000
buff2 0.000000, 0.000000, 1.000000

cgetrf: info == 0
buff 1.000000, 0.000000, 0.000000
buff 0.000000, 1.000000, 0.000000
buff 0.000000, 0.000000, 1.000000

Press any key to continue . . .

--Gennady

Gennady_F_Intel
Moderator
170 Views

Some more questions I've forgotten to ask you:
What MKL versions you are using?
What is you linking line?
OS?
Is it ia32 or Intel64 architecture?

Randy_Cox
Beginner
170 Views

Some more questions I've forgotten to ask you:
What MKL versions you are using?
What is you linking line?
OS?
Is it ia32 or Intel64 architecture?

Hi Gennady, Thank you for taking the time to look at my error, especially on the weekend!
Here is the information you asked for: (Sorry I should of had that in the original post)

MKL Version: 10.2.1 (Originally I was on 10.0, but after your post I upgraded to the lastest version).
Linking Line: I use Visual Studio 2008 (version 9.0). The linking line parameters used by VS is:

/OUT:"C:Documents and SettingsrcoxMy DocumentsProjectscfuncvs-cfuncDebugvs-cfunc.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:Program FilesIntelCompiler11.0�74cpplibia32" /LIBPATH:"C:Program FilesIntelMKL10.2.1.019ia32lib" /LIBPATH:"C:Program FilesIntelIPP6.0.2.074ia32stublib" /MANIFEST /MANIFESTFILE:"Debugvs-cfunc.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"c:Documents and SettingsrcoxMy DocumentsProjectscfuncvs-cfuncDebugvs-cfunc.pdb" /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT libiomp5md.lib mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib ippi.lib ippcv.lib ipps.lib ippm.lib ippcore.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

OS: Windows XP Professional (win32)
Architecture: ia32

Let me know if there is any other information that could help.
Thanks again for helping.

Randy

Gennady_F_Intel
Moderator
171 Views
Randy,

May I ask you to do some more steps in hope to find the problem?
1) to check the problem with the separate project link only MKL?
The linking dependencies are the same you used : mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

2) with the same standalone project to use serial versions:
sequential.lib mkl_intel_c.lib mkl_sequential.lib mkl_core.lib

--Gennady

Randy_Cox
Beginner
170 Views
Randy,

May I ask you to do some more steps in hope to find the problem?
1) to check the problem with the separate project link only MKL?
The linking dependencies are the same you used : mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib

2) with the same standalone project to use serial versions:
sequential.lib mkl_intel_c.lib mkl_sequential.lib mkl_core.lib

--Gennady

Thank you Gennady, Problem fixed.

I was corrupting the Complex parameter prior to the function call.
As you suggested, I removed except MKL, and everything worked fine.
It was then a simple (but tedious) task to add things in until I got the error again.
In hind sight, I should have done this first before posting.
Sorry to spam this forum with a rookie mistake.
I appreciate your help! Thanks. Now I'm moving forward again. :)

Randy
Melvin_Robinson
New Contributor I
170 Views
Quoting - Randy Cox
Thank you Gennady, Problem fixed.

I was corrupting the Complex parameter prior to the function call.
As you suggested, I removed except MKL, and everything worked fine.
It was then a simple (but tedious) task to add things in until I got the error again.
In hind sight, I should have done this first before posting.
Sorry to spam this forum with a rookie mistake.
I appreciate your help! Thanks. Now I'm moving forward again. :)

Randy
In the function call, ipiv should not have an amperstand before it. Your original code worked for me after this change.
Reply