"Division by zero" in culaDeviceDgetri

General CULA Dense (LAPACK & BLAS) support and troubleshooting. Use this forum if you are having a general problem or have encountered a bug.

"Division by zero" in culaDeviceDgetri

Postby VictorGre1 » Mon Dec 13, 2010 6:31 am

My system: GTX-480, CULA 2.1, CUDA 3.1, driver 261

There is an error "Division by zero" after a repeated call (more than 110000 times) procedures culaDeviceDgetri. The matrix which causes an error, has been kept and used unitary after reboot. Errors haven't arisen!
VictorGre1
CULA Premium
 
Posts: 10
Joined: Sat Nov 28, 2009 10:37 am

Re: "Division by zero" in culaDeviceDgetri

Postby john » Wed Dec 15, 2010 2:02 pm

Hello. Can you produce a test example for me?
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: "Division by zero" in culaDeviceDgetri

Postby VictorGre1 » Wed Dec 15, 2010 2:24 pm

I will try to make a test example, however, I program on Delphi. Will approach?
VictorGre1
CULA Premium
 
Posts: 10
Joined: Sat Nov 28, 2009 10:37 am

Re: "Division by zero" in culaDeviceDgetri

Postby john » Wed Dec 15, 2010 2:39 pm

I didn't even realize CULA could be used with Delphi, to be honest. As long as the code is readable, we will attempt to learn it, but we do not support Delphi so I can make no guarantees.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: "Division by zero" in culaDeviceDgetri

Postby VictorGre1 » Wed Dec 15, 2010 3:05 pm

Oh, I see. Porting CULA on Delphi it is made simply. As there are header-files (*.h) functions in dll I have written a similar wrapper on Delphi. Thus, actually, all is written Delphi for Windows API. I will try to write a readable example on Delphi and to send the project and exe.
VictorGre1
CULA Premium
 
Posts: 10
Joined: Sat Nov 28, 2009 10:37 am

Re: "Division by zero" in culaDeviceDgetri

Postby gustavo » Wed Jun 29, 2011 10:22 am

I have translate the header files to Delphi (now only for single(float) and double), and I test it in console mode, up to this point is ok if I only use dynamic arrays, I will explaint this, I'm trying to create the classes TculaVec and TculaMtx like wrappers to Cula, my problem is that after I use a cula function my objects are deleted, here I put my code.

Console Application (this works fine):
Code: Select all
program Console_Cula;

{$APPTYPE CONSOLE}

uses
  SysUtils, Cula;

var
  A, B, X: TculaDoubleVector;
  IPIV: TculaIntVector;
  i: integer;

const
   N = 10;
   NRHS = 1;
   two = 2.0;
   
procedure checkStatus(status: culaStatus);
var buf80: PChar;
begin
  if (status = culaNoError) then
        exit;

  culaGetErrorInfoString(status, culaGetErrorInfo, buf80, sizeof(buf80));
  writeln(buf80);

  culaFreeBuffers;
  culaShutdown;
  exit;
  //exit(EXIT_FAILURE);
end;

procedure Solve(A,B: TculaDoubleVector; var X: TculaDoubleVector);
var IPIV: TculaIntVector;
    N: integer;
begin
  N:= High(B)+1;
  setlength(IPIV, N);
  X:= Copy(B);
  statuscula := culaDgesv(N, NRHS, A[0], N, IPIV[0], X[0], N);
end;

begin
  { TODO -oUser -cConsole Main : Insert code here }
  setlength(A, N*N);
  setlength(B, N);
  setlength(X, N);
 

  checkStatus(statuscula);

  writeln('Matrix A');
  // Set A to the identity matrix
  for i:= 0 to N-1 do
        A[i*N+i]:= two;

  for i:= Low(A) to High(A)  do
    writeln(FloattoStr(A[i]));

  Randomize;

  writeln('Vector B');
  // Set B to a random matrix (see note at top)
  for i:= 0  to N-1 do
        B[i] := Random(100)/10;

  for i:= Low(B) to High(B) do
    writeln(FloattoStr(B[i]));

  X:= Copy(B);
  statuscula := culaDgesv(N, NRHS, A[0], N, IPIV[0], X[0], N);

  writeln('Vector X');
  for i:= 0 to N-1 do
    writeln(FloattoStr(X[i]));

  checkStatus(statuscula);

  culaFreeBuffers;

  readln;
end.


And this is the Cula Interface Unit

Code: Select all
unit CULA;
(*
* Copyright (C) 2009-2010 EM Photonics, Inc.  All rights reserved.
*
* NOTICE TO USER:   
*
* This source code is subject to EM Photonics ownership rights under U.S. and
* international Copyright laws.  Users and possessors of this source code may
* not redistribute this code without the express written consent of EM
* Photonics, Inc.
*
* EM PHOTONICS MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
* CODE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
* WARRANTY OF ANY KIND.  EM PHOTONICS DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL EM
* PHOTONICS BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
* DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS,  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION,  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOURCE CODE.
*
* U.S. Government End Users.   This source code is a "commercial item" as that
* term is defined at  48 C.F.R. 2.101 (OCT 1995), consisting  of "commercial
* computer  software"  and "commercial computer software documentation" as
* such terms are  used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the
* U.S. Government only as a commercial end item.  Consistent with 48
* C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
* U.S. Government End Users acquire the source code with only those rights set
* forth herein.
*
* Any use of this source code in individual and commercial software must
* include, in the user documentation and internal comments to the code, the
* above Disclaimer and U.S. Government End Users Notice.
*
* implmented in Delphi by Gustavo Sanchez 22/Jun/2011
* only single and double
*)

interface

uses SysUtils;

type
culaStatus =
(
    culaNoError,                       // No error
    culaNotInitialized,                // CULA has not been initialized
    culaNoHardware,                    // No hardware is available to run
    culaInsufficientRuntime,           // CUDA runtime or driver is not supported
    culaInsufficientComputeCapability, // Available GPUs do not support the requested operation
    culaInsufficientMemory,            // There is insufficient memory to continue
    culaFeatureNotImplemented,         // The requested feature has not been implemented
    culaArgumentError,                 // An invalid argument was passed to a function
    culaDataError,                     // An operation could not complete because of singular data
    culaBlasError,                     // A blas error was encountered
    culaRuntimeError                   // A runtime error has occurred
);

(**
* @brief Provides extended error information for CULA functions.
* When negative, this value specifies an argument position with an invalid
* value.
*)

info_t= integer;
culaInfo = integer;
culaVersion = integer;

// host types
culaFloat= Single;
PculaFloat= ^culaFloat;
culaDouble= Double;
culaInt= Integer;
PculaInt= ^culaInt;

// device types
culaDeviceFloat= culaFloat;
PculaDeviceFloat= ^culaDeviceFloat;
culaDeviceDouble= culaDouble;
PculaDeviceDouble= ^culaDeviceDouble;
culaDeviceInt= culaInt;
PculaDeviceInt= ^culaDeviceInt;

culaFloatComplex = record
  x, y: culaFloat;
end;
PculaFloatComplex = ^culaFloatComplex;

culaDoubleComplex = record
  x, y: culaDouble;
end;
PculaDoubleComplex = ^culaDoubleComplex;

TculaFloatVector = array of culaFloat;
TculaFloatMatrix = array of array of culaFloat;
TculaDoubleVector = array of culaDouble;
TculaDoubleMatrix = array of array of culaDouble;
TculaIntVector = array of culaInt;
TculaIntMatrix = array of array of Integer;

const
  CULADLL = 'cula.dll';

var
  statuscula: culaStatus;
  SelfValues, VecValues: TculaDoubleVector;
  Ipiv: TculaIntVector;

procedure Solve(A,B: TculaDoubleVector; var X: TculaDoubleVector); 

function IDX2(i, j, rank: integer): integer; {(((j)*(lead_dim))+(i)) }

(**
* @brief Initializes CULA
* Must be called before using any other function.  Some functions have an
* exception to this rule:  culaGetDeviceCount, culaSelectDevice
*
* @return culaNoError on a successful initialization or the culaStatus enum
* that specifies an error
*)
function culaInitialize: culaStatus; stdcall; external CULADLL name 'culaInitialize';

(**
* @brief Shuts down CULA
* Must be called to deallocate CULA internal data
*)
procedure culaShutdown; stdcall; external CULADLL name 'culaShutdown';

(**
* @brief Returns the last status code returned from a CULA function
*
* @return The last CULA status code
*)
function culaGetLastStatus: culaStatus; stdcall; external CULADLL name 'culaGetLastStatus';

(**
* @brief Associates a culaStatus enum with a readable error string
*
* @param e A culaStatus error code
*
* @return A string that corresponds with the specified culaStatus enum
*)
function culaGetStatusString( e: culaStatus): PChar; stdcall; external CULADLL name 'culaGetStatusString';

(**
* @brief This function is used to provide extended functionality that LAPACK's
* info parameter typically provides
*
* @return Extended information about the last error or zero if it is
* unavailable
*)
function culaGetErrorInfo: info_t; stdcall; external CULADLL name 'culaGetErrorInfo';

(**
* @brief Associates a culaStatus and info_t with a readable error string
*
* @param e A culaStatus error code
* @param i An info_t error code
* @param buf Pointer to a buffer into which information will be printed
* @param bufsize The size of buf, printed information will not exceed bufsize
*
* @return culaNoError on a successful error report or culaArgumentError on an
* invalid argument to this function
*)
function culaGetErrorInfoString(e: culaStatus; i: info_t; buf: PChar; bufsize: integer): culaStatus ;
                               stdcall; external CULADLL name 'culaGetErrorInfoString';

(**
* @brief Releases any memory buffers stored internally by CULA
*)
procedure culaFreeBuffers; stdcall; external CULADLL name 'culaFreeBuffers';

(**
* @brief Reports the number of GPU devices
* Can be called before culaInitialize
*
* @param num Pointer to receive the number of devices
*
* @return culaNoError on sucess, culaArgumentError on invalid pointer
*)
function culaGetDeviceCount(var dev: Integer): culaStatus; stdcall; external CULADLL name 'culaGetDeviceCount';

(**
* @brief Selects a device with which CULA will operate
* To bind without error, this function must be called before culaInitialize
*
* @param dev Specifies the device id of the GPU device
*
* @return culaNoError on sucess, culaArgumentError on an invalid device id,
* culaRuntimeError if the running thread has already been bound to a GPU device
*)
function culaSelectDevice(dev: integer): culaStatus; stdcall; external CULADLL name 'culaSelectDevice';

(**
* @brief Reports the id of the GPU device executing CULA
*
* @param dev Pointer to receive the GPU device number
*
* @return culaNoError on sucess, culaArgumentError on invalid pointer
*)
function culaGetExecutingDevice(var dev: integer): culaStatus; stdcall; external CULADLL name 'culaGetExecutingDevice';

(**
* @brief Prints information to a buffer about a specified device
*
* @param dev CUDA device id to print information about
* @param buf Pointer to a buffer into which information will be printed
* @param bufsize The size of buf, printed information will not exceed bufsize
*
* @return culaNoError on sucess, culaArgumentError on invalid buf pointer,
* invalid device id, or invalid bufsize
*)
function culaGetDeviceInfo(dev: integer; buf: PChar; bufsize: Integer): culaStatus; stdcall; external CULADLL name 'culaGetDeviceInfo';

(**
* @brief Allocates memory on the device in a pitch that is optimal for CULA
*
* @param mem Pointer to which a newly allocated buffer will be assigned
* @param pitch The pitch of the allocation in elements (where *pitch >= rows)
* @param rows The number of rows of the matrix
* @param cols The number of columns of the matrix
* @param elesize The size in bytes of the desired element
*
* @return culaNoError on successful allocation, culaInsufficientMemory on failure
*)
function culaDeviceMalloc(mem: Pointer; var pitch: integer; rows: integer; cols: integer; elesize: integer): culaStatus; stdcall; external CULADLL name 'culaDeviceMalloc';


(**
* @brief Frees memory that has been allocated with culaDeviceMalloc
*
* @param mem Pointer to a buffer that is to be freed
*
* @return culaNoError on successful free, culaArgumentError on failure
*)
function culaDeviceFree(mem: Pointer): culaStatus; stdcall; external CULADLL name 'culaDeviceFree';


(*  culapack.h functions only single and double  *)

  function culaDbdsqr(uplo: char; n: Integer; ncvt: Integer; nru: Integer; ncc: Integer;
    var d: culaDouble; var e: culaDouble; var vt: culaDouble; ldvt: Integer; var u: culaDouble;
    ldu: Integer; var c: culaDouble; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaDbdsqr';
  function culaDgbtrf(m: Integer; n: Integer; kl: Integer; ku: Integer; var a: culaDouble;
    lda: Integer; var ipiv: culaInt): culaStatus; stdcall; external CULADLL name 'culaDgbtrf';
  function culaDgeNancheck(m: Integer; n: Integer; var a: culaDouble; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaDgeNancheck';
  function culaDgeTranspose(m: Integer; n: Integer; var a: culaDouble; lda: Integer;
    var b: culaDouble; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaDgeTranspose';
  function culaDgeTransposeInplace(n: Integer; var a: culaDouble; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaDgeTransposeInplace';
  function culaDgebrd(m: Integer; n: Integer; var a: culaDouble; lda: Integer;
    var d: culaDouble; var e: culaDouble; var tauq: culaDouble; var taup: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDgebrd';
  function culaDgeev(jobvl: char; jobvr: char; n: Integer; var a: culaDouble; lda: Integer;
    var wr: culaDouble; var wi: culaDouble; var vl: culaDouble; ldvl: Integer; var vr: culaDouble;
    ldvr: Integer): culaStatus; stdcall; external CULADLL name 'culaDgeev';
  function culaDgehrd(n: Integer; ilo: Integer; ihi: Integer; var a: culaDouble;
    lda: Integer; var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDgehrd';
  function culaDgelqf(m: Integer; n: Integer; var a: culaDouble; lda: Integer;
    var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDgelqf';
  function culaDgels(trans: char; m: Integer; n: Integer; nrhs: Integer; var a: culaDouble;
    lda: Integer; var b: culaDouble; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaDgels';
  function culaDgeqlf(m: Integer; n: Integer; var a: culaDouble; lda: Integer;
    var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDgeqlf';
  function culaDgeqrf(m: Integer; n: Integer; var a: culaDouble; lda: Integer;
    var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDgeqrf';
  function culaDgeqrs(m: Integer; n: Integer; nrhs: Integer; var a: culaDouble;
    lda: Integer; var tau: culaDouble; var b: culaDouble; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaDgeqrs';
  function culaDgerqf(m: Integer; n: Integer; var a: culaDouble; lda: Integer;
    var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDgerqf';
  function culaDgesv(var n: Integer; var nrhs: Integer; var a: culaDouble; var lda: Integer;
    var ipiv: culaInt; var b: culaDouble; var ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaDgesv';
  function culaDgesvd(jobu: char; jobvt: char; m: Integer; n: Integer; var a: culaDouble;
    lda: Integer; var s: culaDouble; var u: culaDouble; ldu: Integer; var vt: culaDouble;
    ldvt: Integer): culaStatus; stdcall; external CULADLL name 'culaDgesvd';
  function culaDgetrf(m: Integer; n: Integer; var a: culaDouble; lda: Integer;
    var ipiv: culaInt): culaStatus; stdcall; external CULADLL name 'culaDgetrf';
  function culaDgetri(n: Integer; var a: culaDouble; lda: Integer; var ipiv: culaInt): culaStatus; stdcall; external CULADLL name 'culaDgetri';
  function culaDgetrs(trans: char; n: Integer; nrhs: Integer; var a: culaDouble;
    lda: Integer; var ipiv: culaInt; var b: culaDouble; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaDgetrs';
  function culaDgglse(m: Integer; n: Integer; p: Integer; var a: culaDouble; lda: Integer;
    var b: culaDouble; ldb: Integer; var c: culaDouble; var d: culaDouble; var x: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDgglse';
  function culaDggrqf(m: Integer; p: Integer; n: Integer; var a: culaDouble; lda: Integer;
    var taua: culaDouble; var b: culaDouble; ldb: Integer; var taub: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDggrqf';
  function culaDlacpy(uplo: char; m: Integer; n: Integer; var a: culaDouble; lda: Integer;
    var b: culaDouble; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaDlacpy';
  function culaDlag2s(m: Integer; n: Integer; var a: culaDouble; lda: Integer;
    var sa: culaFloat; ldsa: Integer): culaStatus; stdcall; external CULADLL name 'culaDlag2s';
  function culaDlar2v(n: Integer; var x: culaDouble; var y: culaDouble; var z: culaDouble;
    incx: Integer; var c: culaDouble; var s: culaDouble; incc: Integer): culaStatus; stdcall; external CULADLL name 'culaDlar2v';
  function culaDlarfb(side: char; trans: char; direct: char; storev: char; m: Integer;
    n: Integer; k: Integer; var v: culaDouble; ldv: Integer; var t: culaDouble; ldt: Integer;
    var c: culaDouble; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaDlarfb';
  function culaDlarfg(n: Integer; var alpha: culaDouble; var x: culaDouble; incx: Integer;
    var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDlarfg';
  function culaDlargv(n: Integer; var x: culaDouble; incx: Integer; var y: culaDouble;
    incy: Integer; var c: culaDouble; incc: Integer): culaStatus; stdcall; external CULADLL name 'culaDlargv';
  function culaDlartv(n: Integer; var x: culaDouble; incx: Integer; var y: culaDouble;
    incy: Integer; var c: culaDouble; var s: culaDouble; incc: Integer): culaStatus; stdcall; external CULADLL name 'culaDlartv';
  function culaDlascl(typee: char; kl: Integer; ku: Integer; cfrom: culaDouble;
    cto: culaDouble; m: Integer; n: Integer; var a: culaDouble; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaDlascl';
  function culaDlaset(uplo: char; m: Integer; n: Integer; alpha: culaDouble; beta: culaDouble;
    var a: culaDouble; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaDlaset';
  function culaDlasr(side: char; pivot: char; direct: char; m: Integer; n: Integer;
    var c: culaDouble; var s: culaDouble; var a: culaDouble; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaDlasr';
  function culaDlat2s(uplo: char; n: Integer; var a: culaDouble; lda: Integer;
    var sa: culaFloat; ldsa: Integer): culaStatus; stdcall; external CULADLL name 'culaDlat2s';
  function culaDorgbr(vect: char; m: Integer; n: Integer; k: Integer; var a: culaDouble;
    lda: Integer; var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDorgbr';
  function culaDorghr(n: Integer; ilo: Integer; ihi: Integer; var a: culaDouble;
    lda: Integer; var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDorghr';
  function culaDorglq(m: Integer; n: Integer; k: Integer; var a: culaDouble; lda: Integer;
    var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDorglq';
  function culaDorgql(m: Integer; n: Integer; k: Integer; var a: culaDouble; lda: Integer;
    var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDorgql';
  function culaDorgqr(m: Integer; n: Integer; k: Integer; var a: culaDouble; lda: Integer;
    var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDorgqr';
  function culaDorgrq(m: Integer; n: Integer; k: Integer; var a: culaDouble; lda: Integer;
    var tau: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDorgrq';
  function culaDormlq(side: char; trans: char; m: Integer; n: Integer; k: Integer;
    var a: culaDouble; lda: Integer; var tau: culaDouble; var c: culaDouble; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaDormlq';
  function culaDormql(side: char; trans: char; m: Integer; n: Integer; k: Integer;
    var a: culaDouble; lda: Integer; var tau: culaDouble; var c: culaDouble; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaDormql';
  function culaDormqr(side: char; trans: char; m: Integer; n: Integer; k: Integer;
    var a: culaDouble; lda: Integer; var tau: culaDouble; var c: culaDouble; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaDormqr';
  function culaDormrq(side: char; trans: char; m: Integer; n: Integer; k: Integer;
    var a: culaDouble; lda: Integer; var tau: culaDouble; var c: culaDouble; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaDormrq';
  function culaDpbtrf(uplo: char; n: Integer; kd: Integer; var ab: culaDouble;
    ldab: Integer): culaStatus; stdcall; external CULADLL name 'culaDpbtrf';
  function culaDposv(uplo: char; n: Integer; nrhs: Integer; var a: culaDouble;
    lda: Integer; var b: culaDouble; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaDposv';
  function culaDpotrf(uplo: char; n: Integer; var a: culaDouble; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaDpotrf';
  function culaDpotrs(uplo: char; n: Integer; nrhs: Integer; var a: culaDouble;
    lda: Integer; var b: culaDouble; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaDpotrs';
  function culaDsgesv(n: Integer; nrhs: Integer; var a: culaDouble; lda: Integer;
    var ipiv: culaInt; var b: culaDouble; ldb: Integer; var x: culaDouble; ldx: Integer;
    var iter: Integer): culaStatus; stdcall; external CULADLL name 'culaDsgesv';
  function culaDsposv(uplo: char; n: Integer; nrhs: Integer; var a: culaDouble;
    lda: Integer; var b: culaDouble; ldb: Integer; var x: culaDouble; ldx: Integer;
    var iter: Integer): culaStatus; stdcall; external CULADLL name 'culaDsposv';
  function culaDstebz(range: char; order: char; n: Integer; vl: double; vu: double;
    il: Integer; iu: Integer; abstol: double; var d: culaDouble; var e: culaDouble;
    var m: Integer; var nsplit: Integer; var w: culaDouble; var isplit: culaInt;
    var iblock: culaInt): culaStatus; stdcall; external CULADLL name 'culaDstebz';
  function culaDsteqr(compz: char; n: Integer; var d: culaDouble; var e: culaDouble;
    var z: culaDouble; ldz: Integer): culaStatus; stdcall; external CULADLL name 'culaDsteqr';
  function culaDsyev(jobz: char; uplo: char; n: Integer; var a: culaDouble; lda: Integer;
    var w: culaDouble): culaStatus; stdcall; external CULADLL name 'culaDsyev';
  function culaDsyevx(jobz: char; range: char; uplo: char; n: Integer; var a: culaDouble;
    lda: Integer; vl: culaDouble; vu: culaDouble; il: Integer; iu: Integer; abstol: culaDouble;
    var m: culaInt; var w: culaDouble; var z: culaDouble; ldz: Integer; var ifail: culaInt): culaStatus; stdcall; external CULADLL name 'culaDsyevx';
  function culaDsyrdb(jobz: char; uplo: char; n: Integer; kd: Integer; var a: culaDouble;
    lda: Integer; var d: culaDouble; var e: culaDouble; var tau: culaDouble; var z: culaDouble;
    ldz: Integer): culaStatus; stdcall; external CULADLL name 'culaDsyrdb';
  function culaDtrtri(uplo: char; diag: char; n: Integer; var a: culaDouble; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaDtrtri';
  function culaDtrtrs(uplo: char; trans: char; diag: char; n: Integer; nrhs: Integer;
    var a: culaDouble; lda: Integer; var b: culaDouble; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaDtrtrs';
  function culaSbdsqr(uplo: char; n: Integer; ncvt: Integer; nru: Integer; ncc: Integer;
    var d: culaFloat; var e: culaFloat; var vt: culaFloat; ldvt: Integer; var u: culaFloat;
    ldu: Integer; var c: culaFloat; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaSbdsqr';
  function culaSgbtrf(m: Integer; n: Integer; kl: Integer; ku: Integer; var a: culaFloat;
    lda: Integer; var ipiv: culaInt): culaStatus; stdcall; external CULADLL name 'culaSgbtrf';
  function culaSgeNancheck(m: Integer; n: Integer; var a: culaFloat; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaSgeNancheck';
  function culaSgeTranspose(m: Integer; n: Integer; var a: culaFloat; lda: Integer;
    var b: culaFloat; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaSgeTranspose';
  function culaSgeTransposeInplace(n: Integer; var a: culaFloat; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaSgeTransposeInplace';
  function culaSgebrd(m: Integer; n: Integer; var a: culaFloat; lda: Integer; var d: culaFloat;
    var e: culaFloat; var tauq: culaFloat; var taup: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSgebrd';
  function culaSgeev(jobvl: char; jobvr: char; n: Integer; var a: culaFloat; lda: Integer;
    var wr: culaFloat; var wi: culaFloat; var vl: culaFloat; ldvl: Integer; var vr: culaFloat;
    ldvr: Integer): culaStatus; stdcall; external CULADLL name 'culaSgeev';
  function culaSgehrd(n: Integer; ilo: Integer; ihi: Integer; var a: culaFloat;
    lda: Integer; var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSgehrd';
  function culaSgelqf(m: Integer; n: Integer; var a: culaFloat; lda: Integer; var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSgelqf';
  function culaSgels(trans: char; m: Integer; n: Integer; nrhs: Integer; var a: culaFloat;
    lda: Integer; var b: culaFloat; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaSgels';
  function culaSgeqlf(m: Integer; n: Integer; var a: culaFloat; lda: Integer; var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSgeqlf';
  function culaSgeqrf(m: Integer; n: Integer; var a: culaFloat; lda: Integer; var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSgeqrf';
  function culaSgeqrs(m: Integer; n: Integer; nrhs: Integer; var a: culaFloat;
    lda: Integer; var tau: culaFloat; var b: culaFloat; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaSgeqrs';
  function culaSgerqf(m: Integer; n: Integer; var a: culaFloat; lda: Integer; var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSgerqf';
  function culaSgesv(n: Integer; nrhs: Integer; var a: culaFloat; lda: Integer;
    var ipiv: culaInt; var b: culaFloat; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaSgesv';
  function culaSgesvd(jobu: char; jobvt: char; m: Integer; n: Integer; var a: culaFloat;
    lda: Integer; var s: culaFloat; var u: culaFloat; ldu: Integer; var vt: culaFloat;
    ldvt: Integer): culaStatus; stdcall; external CULADLL name 'culaSgesvd';
  function culaSgetrf(m: Integer; n: Integer; var a: culaFloat; lda: Integer; var ipiv: culaInt): culaStatus; stdcall; external CULADLL name 'culaSgetrf';
  function culaSgetri(n: Integer; var a: culaFloat; lda: Integer; var ipiv: culaInt): culaStatus; stdcall; external CULADLL name 'culaSgetri';
  function culaSgetrs(trans: char; n: Integer; nrhs: Integer; var a: culaFloat;
    lda: Integer; var ipiv: culaInt; var b: culaFloat; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaSgetrs';
  function culaSgglse(m: Integer; n: Integer; p: Integer; var a: culaFloat; lda: Integer;
    var b: culaFloat; ldb: Integer; var c: culaFloat; var d: culaFloat; var x: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSgglse';
  function culaSggrqf(m: Integer; p: Integer; n: Integer; var a: culaFloat; lda: Integer;
    var taua: culaFloat; var b: culaFloat; ldb: Integer; var taub: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSggrqf';
  function culaSlacpy(uplo: char; m: Integer; n: Integer; var a: culaFloat; lda: Integer;
    var b: culaFloat; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaSlacpy';
  function culaSlag2d(m: Integer; n: Integer; var a: culaFloat; lda: Integer; var sa: culaDouble;
    ldsa: Integer): culaStatus; stdcall; external CULADLL name 'culaSlag2d';
  function culaSlar2v(n: Integer; var x: culaFloat; var y: culaFloat; var z: culaFloat;
    incx: Integer; var c: culaFloat; var s: culaFloat; incc: Integer): culaStatus; stdcall; external CULADLL name 'culaSlar2v';
  function culaSlarfb(side: char; trans: char; direct: char; storev: char; m: Integer;
    n: Integer; k: Integer; var v: culaFloat; ldv: Integer; var t: culaFloat; ldt: Integer;
    var c: culaFloat; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaSlarfb';
  function culaSlarfg(n: Integer; var alpha: culaFloat; var x: culaFloat; incx: Integer;
    var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSlarfg';
  function culaSlargv(n: Integer; var x: culaFloat; incx: Integer; var y: culaFloat;
    incy: Integer; var c: culaFloat; incc: Integer): culaStatus; stdcall; external CULADLL name 'culaSlargv';
  function culaSlartv(n: Integer; var x: culaFloat; incx: Integer; var y: culaFloat;
    incy: Integer; var c: culaFloat; var s: culaFloat; incc: Integer): culaStatus; stdcall; external CULADLL name 'culaSlart';
  function culaSlascl(typee: char; kl: Integer; ku: Integer; cfrom: culaFloat; cto: culaFloat;
    m: Integer; n: Integer; var a: culaFloat; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaSlascl';
  function culaSlaset(uplo: char; m: Integer; n: Integer; alpha: culaFloat; beta: culaFloat;
    var a: culaFloat; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaSlaset';
  function culaSlasr(side: char; pivot: char; direct: char; m: Integer; n: Integer;
    var c: culaFloat; var s: culaFloat; var a: culaFloat; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaSlasr';
  function culaSlat2d(uplo: char; n: Integer; var a: culaFloat; lda: Integer; var sa: culaDouble;
    ldsa: Integer): culaStatus; stdcall; external CULADLL name 'culaSlat2d';
  function culaSorgbr(vect: char; m: Integer; n: Integer; k: Integer; var a: culaFloat;
    lda: Integer; var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSorgbr';
  function culaSorghr(n: Integer; ilo: Integer; ihi: Integer; var a: culaFloat;
    lda: Integer; var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSorghr';
  function culaSorglq(m: Integer; n: Integer; k: Integer; var a: culaFloat; lda: Integer;
    var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSorglq';
  function culaSorgql(m: Integer; n: Integer; k: Integer; var a: culaFloat; lda: Integer;
    var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSorgql';
  function culaSorgqr(m: Integer; n: Integer; k: Integer; var a: culaFloat; lda: Integer;
    var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSorgqr';
  function culaSorgrq(m: Integer; n: Integer; k: Integer; var a: culaFloat; lda: Integer;
    var tau: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSorgrq';
  function culaSormlq(side: char; trans: char; m: Integer; n: Integer; k: Integer;
    var a: culaFloat; lda: Integer; var tau: culaFloat; var c: culaFloat; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaSormlq';
  function culaSormql(side: char; trans: char; m: Integer; n: Integer; k: Integer;
    var a: culaFloat; lda: Integer; var tau: culaFloat; var c: culaFloat; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaSormql';
  function culaSormqr(side: char; trans: char; m: Integer; n: Integer; k: Integer;
    var a: culaFloat; lda: Integer; var tau: culaFloat; var c: culaFloat; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaSormqr';
  function culaSormrq(side: char; trans: char; m: Integer; n: Integer; k: Integer;
    var a: culaFloat; lda: Integer; var tau: culaFloat; var c: culaFloat; ldc: Integer): culaStatus; stdcall; external CULADLL name 'culaSormrq';
  function culaSpbtrf(uplo: char; n: Integer; kd: Integer; var ab: culaFloat; ldab: Integer): culaStatus; stdcall; external CULADLL name 'culaSpbtrf';
  function culaSposv(uplo: char; n: Integer; nrhs: Integer; var a: culaFloat; lda: Integer;
    var b: culaFloat; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaSposv';
  function culaSpotrf(uplo: char; n: Integer; var a: culaFloat; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaSpotrf';
  function culaSpotrs(uplo: char; n: Integer; nrhs: Integer; var a: culaFloat;
    lda: Integer; var b: culaFloat; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaSpotrs';
  function culaSstebz(range: char; order: char; n: Integer; vl: Single; vu: Single;
    il: Integer; iu: Integer; abstol: Single; var d: culaFloat; var e: culaFloat;
    var m: Integer; var nsplit: Integer; var w: culaFloat; var isplit: culaInt; var iblock: culaInt): culaStatus; stdcall; external CULADLL name 'culaSstebz';
  function culaSsteqr(compz: char; n: Integer; var d: culaFloat; var e: culaFloat;
    var z: culaFloat; ldz: Integer): culaStatus; stdcall; external CULADLL name 'culaSsteqr';
  function culaSsyev(jobz: char; uplo: char; n: Integer; var a: culaFloat; lda: Integer;
    var w: culaFloat): culaStatus; stdcall; external CULADLL name 'culaSsyev';
  function culaSsyevx(jobz: char; range: char; uplo: char; n: Integer; var a: culaFloat;
    lda: Integer; vl: culaFloat; vu: culaFloat; il: Integer; iu: Integer; abstol: culaFloat;
    var m: culaInt; var w: culaFloat; var z: culaFloat; ldz: Integer; var ifail: culaInt): culaStatus; stdcall; external CULADLL name 'culaSsyevx';
  function culaSsyrdb(jobz: char; uplo: char; n: Integer; kd: Integer; var a: culaFloat;
    lda: Integer; var d: culaFloat; var e: culaFloat; var tau: culaFloat; var z: culaFloat;
    ldz: Integer): culaStatus; stdcall; external CULADLL name 'culaSsyrdb';
  function culaStrtri(uplo: char; diag: char; n: Integer; var a: culaFloat; lda: Integer): culaStatus; stdcall; external CULADLL name 'culaStrtri';
  function culaStrtrs(uplo: char; trans: char; diag: char; n: Integer; nrhs: Integer;
    var a: culaFloat; lda: Integer; var b: culaFloat; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaStrtrs';


(*  culablas.h functions only single and double  *)
function culaDgemm(transa: char; transb: char; m: integer; n: integer; k: integer; alpha: culaDouble; var a: culaDouble; lda: integer; var b: culaDouble; ldb: integer; beta: culaDouble; var c: culaDouble; ldc: integer): culaStatus; stdcall; external CULADLL name 'culaDgemm';
function culaDgemv(trans: char; m: integer; n: integer; alpha: culaDouble; var a: culaDouble; lda: integer; var x: culaDouble; incx: integer; beta: culaDouble; var y: culaDouble; incy: integer): culaStatus; stdcall; external CULADLL name 'culaDgemv';
function culaDsymm(side: char; uplo: char; m: integer; n: integer; alpha: culaDouble; var a: culaDouble; lda: integer; var b: culaDouble; ldb: integer; beta: culaDouble; var c: culaDouble; ldc: integer): culaStatus; stdcall; external CULADLL name 'culaDsymm';
function culaDsymv(uplo: char; n: integer; alpha: culaDouble; var a: culaDouble; lda: integer; var x: culaDouble; incx: integer; beta: culaDouble; var y: culaDouble; incy: integer): culaStatus; stdcall; external CULADLL name 'culaDsymv';
function culaDsyr2k(uplo: char; trans: char; n: integer; k: integer; alpha: culaDouble; var a: culaDouble; lda: integer; var b: culaDouble; ldb: integer; beta: culaDouble; var c: culaDouble; ldc: integer): culaStatus; stdcall; external CULADLL name 'culaDsyr2k';
function culaDsyrk(uplo: char; trans: char; n: integer; k: integer; alpha: culaDouble; var a: culaDouble; lda: integer; beta: culaDouble; var c: culaDouble; ldc: integer): culaStatus; stdcall; external CULADLL name 'culaDsyrk';
function culaDtrmm(side: char; uplo: char; transa: char; diag: char; m: integer; n: integer; alpha: culaDouble; var a: culaDouble; lda: integer; var b: culaDouble; ldb: integer): culaStatus; stdcall; external CULADLL name 'culaDtrmm';
function culaDtrsm(side: char; uplo: char; transa: char; diag: char; m: integer; n: integer; alpha: culaDouble; var a: culaDouble; lda: integer; var b: culaDouble; ldb: integer): culaStatus; stdcall; external CULADLL name 'culaDtrsm';
function culaSgemm(transa: char; transb: char; m: integer; n: integer; k: integer; alpha: culaFloat; var a: culaFloat; lda: integer; var b: culaFloat; ldb: integer; beta: culaFloat; var c: culaFloat; ldc: integer): culaStatus; stdcall; external CULADLL name 'culaSgemm';
function culaSgemv(trans: char; m: integer; n: integer; alpha: culaFloat; var a: culaFloat; lda: integer; var x: culaFloat; incx: integer; beta: culaFloat; var y: culaFloat; incy: integer): culaStatus; stdcall; external CULADLL name 'culaSgemv';
function culaSsymm(side: char; uplo: char; m: integer; n: integer; alpha: culaFloat; var a: culaFloat; lda: integer; var b: culaFloat; ldb: integer; beta: culaFloat; var c: culaFloat; ldc: integer): culaStatus; stdcall; external CULADLL name 'culaSsymm';
function culaSsymv(uplo: char; n: integer; alpha: culaFloat; var a: culaFloat; lda: integer; var x: culaFloat; incx: integer; beta: culaFloat; var y: culaFloat; incy: integer): culaStatus; stdcall; external CULADLL name 'culaSsymv';
function culaSsyr2k(uplo: char; trans: char; n: integer; k: integer; alpha: culaFloat; var a: culaFloat; lda: integer; var b: culaFloat; ldb: integer; beta: culaFloat; var c: culaFloat; ldc: integer): culaStatus; stdcall; external CULADLL name 'culaSsyr2k';
function culaSsyrk(uplo: char; trans: char; n: integer; k: integer; alpha: culaFloat; var a: culaFloat; lda: integer; beta: culaFloat; var c: culaFloat; ldc: integer): culaStatus; stdcall; external CULADLL name 'culaSsyrk';
function culaStrmm(side: char; uplo: char; transa: char; diag: char; m: integer; n: integer; alpha: culaFloat; var a: culaFloat; lda: integer; var b: culaFloat; ldb: integer): culaStatus; stdcall; external CULADLL name 'culaStrmm';
function culaStrsm(side: char; uplo: char; transa: char; diag: char; m: integer; n: integer; alpha: culaFloat; var a: culaFloat; lda: integer; var b: culaFloat; ldb: integer): culaStatus; stdcall; external CULADLL name 'culaStrsm';


implementation

procedure Solve(A,B: TculaDoubleVector; var X: TculaDoubleVector);
var SelfValues, VecValues: TculaDoubleVector;
    IPIV: TculaIntVector;
    N, RHS: integer;
begin
  RHS:= 1;
  N:= High(B)+1;
  setlength(SelfValues,N*N);
  setlength(VecValues,N);
  setlength(IPIV, N);
  SelfValues:= Copy(A);
  VecValues:= Copy(B);
  statuscula := culaDgesv(N, RHS, SelfValues[0], N, IPIV[0], VecValues[0], N);
  X:= Copy(VecValues);
end;

function IDX2(i, j, rank: integer): integer;
begin
result:= j*rank+i;
end;

initialization
begin
  statuscula:= culaInitialize;
end;

finalization
begin
  culaShutdown;
end;

end.


And here my code when I'm trying to use TculaVec and TculaMtx

Code: Select all
program Console_Cula_Objects;

{$APPTYPE CONSOLE}

uses
  SysUtils, CULA_Mtx_Vec;

var
  A: TculaMtx;
  B, X: TculaVec;
  i: integer;

const
  N = 10;

begin
  { TODO -oUser -cConsole Main : Insert code here }
  A:= TculaMtx.Create(N);

  for i:= 0 to N-1 do
        A.Value[i,i]:= 3.0;


  B:= TculaVec.Create(N);

  for i:= 0  to N-1 do
        B.Value[i] := 10;

  X:= B;

  X:= TculaVec.Create(N);

  //A.Solve(B);
  X:= A.SolveLU(B);

  for i:= 0  to N-1 do
        writeln(X.Value[i]);

  readln;
end.


Here is my Vector and Matrix Classes (I use Cublas too for some functions, no probelm with those):

Code: Select all
unit CULA_Mtx_Vec;

interface

uses SysUtils, CULA;

type
  TCulaVec = Class
  private
    function GetValue(index: integer): culaDouble;
    procedure SetValue(index: integer; const Value: culaDouble);
  protected
  FLength: integer;
  Values: TculaDoubleVector;
  public
  constructor Create(n: integer);
  property Value[index: integer]: culaDouble read GetValue write SetValue;
  end;

  TCulaMtx = Class
  private
    function GetValue(col, row: integer): culaDouble;
    procedure SetValue(col, row: integer; const Value: culaDouble);
  protected
  FLength: integer;
  Frank: integer;
  Values: TculaDoubleVector;
  public
  constructor Create(n: integer);
  function SolveLU(B: TculaVec): TculaVec;
  procedure Solve(X: TculaVec);
  property Value[col, row: integer]: culaDouble read GetValue write SetValue;
  end;

const
  CULADLL = 'cula.dll';

var
  SelfValues, VecValues: TculaDoubleVector;
  Ipiv: TculaIntVector;

function culaDeviceDgesv(n: Integer; nrhs: Integer; var a: culaDouble; lda: Integer;
    var ipiv: culaInt; var b: culaDouble; ldb: Integer): culaStatus; stdcall; external CULADLL name 'culaDeviceDgesv';


implementation

{ TCulaVec }

constructor TCulaVec.Create(n: integer);
begin
  inherited Create;
  Flength:= n;
  setlength(Values, n);
end;

function TCulaVec.GetValue(index: integer): culaDouble;
begin
  result:= Values[index];
end;

procedure TCulaVec.SetValue(index: integer; const Value: culaDouble);
begin
  Values[index]:= Value;
end;

{ TCulaMtx }

constructor TCulaMtx.Create(n: integer);
begin
  Frank:= n;
  Flength:= n*n;
  setlength(Values, Flength);
end;

function TCulaMtx.GetValue(col, row: integer): culaDouble;
begin
  result:= Values[IDX2(col, row, Frank)];
end;

procedure TCulaMtx.SetValue(col, row: integer; const Value: culaDouble);
begin
  Values[IDX2(col, row, Frank)]:= Value;
end;

function TCulaMtx.SolveLU(B: TculaVec): TculaVec;
var i: integer;
begin

  Result:= TculaVec.Create(Frank);

  setlength(SelfValues,Flength);
  setlength(VecValues,Frank);
  setlength(Ipiv,Frank);

  SelfValues:= Copy(Self.Values,0,Flength);

  VecValues:= Copy(B.Values,0, B.FLength);

  statuscula:= culaDgesv(Frank, 1, SelfValues[0], Frank, Ipiv[0], VecValues[0], Frank);

  Result.Values:= Copy(VecValues,0,Frank);

  culaInitialize;
end;


procedure TCulaMtx.Solve(X: TculaVec);
begin

  setlength(SelfValues,Flength);
  setlength(VecValues,Frank);
  setlength(Ipiv,Frank);

  SelfValues:= Copy(Self.Values,0,Flength);

  VecValues:= Copy(X.Values,0, X.FLength);

  statuscula:= culaDgesv(Frank, 1, SelfValues[0], Frank, Ipiv[0], VecValues[0], Frank);

  X.Values:= Copy(VecValues,0, X.FLength);


end;


function IDX2(i, j, rank: integer): integer;
begin
result:= j*rank+i;
end;


end.
gustavo
CULA Premium
 
Posts: 5
Joined: Fri Jun 17, 2011 7:03 pm

Re: "Division by zero" in culaDeviceDgetri

Postby john » Fri Jul 01, 2011 10:41 am

I don't know enough about Delphi to really comment, but if the code works with plain arrays but not objects then I would double check that your objects are behaving as you intend them to.

You do appear to be sometimes interchanging whether you are treating your matrices are row major or column major. CULA (like most LAPACKs) expects data to be in column major format.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: "Division by zero" in culaDeviceDgetri

Postby gustavo » Sat Jul 02, 2011 11:58 pm

Ok, my error was because I used the dynamic arrays that comes with Delphi (since Delphi 4), now I after I create my arrays using the old GetMem and FreeMem procedure sthe error is gone and my Visual Objects are not delete. I will correct my interface units using arrays the old way and I will post them here in case that some body want to use CULA with Delphi.

Code: Select all
type
TSingleVector = array[0..0] of Single;
PSingleVector = ^TSingleVector;
TDoubleVector = array[0..0] of Double;
PDoubleVector = ^TDoubleVector;
TIntVector = array[0..0] of Integer;
PIntVector = ^TIntVector;
...
var
  Values: PDoubleVector;
...
begin
  GetMem(values, sizeof(Double)*n);
gustavo
CULA Premium
 
Posts: 5
Joined: Fri Jun 17, 2011 7:03 pm


Return to CULA Dense Support

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest