I'm working with C# in VS2022 Enviroment. I have a program that uses large array and pass these array to mkl dll. It seams debugging that C part receive a wrong data after 4GB block. While debugging C# side (looping the array) all values appear correct.
Any one have faced this kind of problem? consider that the application has this properties set: gcAllowVeryLargeObjects = "true" And is compiled for x64 platform.
It seams C# cannot alloc a block of memory more than 4G contiguously.
Or is it possible that the parameter declaration in C# is not properly configured?
This is how variables are declared in C#:
int MAX_SIZE = 16385; //limit 16385
Complex[,] A = new Complex[MAX_SIZE, MAX_SIZE];
Complex[] b = new Complex[MAX_SIZE];
The arrays are populated than passed to the dll.
This is the dll declaration in C#:
[DllImport("mkl_rt.2.dll", ExactSpelling = true, SetLastError = false, CallingConvention = CallingConvention.Cdecl)]
internal static extern int LAPACKE_zgesvxx(
int matrix_layout,
char fact,
char trans,
Int64 n,
Int64 nrhs,
[In, Out] Complex* A,
Int64 lda,
[In, Out] Complex* af,
Int64 ldaf,
int[] ipiv,
ref char equed,
[In, Out] double* r,
[In, Out] double* c,
[In, Out] Complex* B,
Int64 ldb,
[In, Out] Complex* x,
Int64 ldx,
ref double rcond,
ref double rpvgrw,
[In, Out] double[] berr,
int n_err_bnds,
[In, Out] double[] err_bnds_norm,
[In, Out] double[] err_bnds_comp,
int nparams,
[In, Out] double[] parameters
);
Thank you