Commit b5cbabcb authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Update compilation flags

parents 80c8faa2 165c64e9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -33,8 +33,12 @@
#endif

#ifdef USE_LAPACK
#ifdef USE_MKL
#include <mkl_lapacke.h>
#else
#include <lapacke.h>
#endif
#ifndef INCLUDE_LAPACK_CALLS_H_
#include "lapacke.h"
#include "../include/lapack_calls.h"
#endif
#endif
+12 −6
Original line number Diff line number Diff line
@@ -12,23 +12,29 @@
 * legacy serial function implementation is used as a fall-back.
 */

#ifdef USE_LAPACK
#ifdef USE_MKL
#include <mkl_lapacke.h>
#else
#include <lapacke.h>
#endif
#else
#define lapack_int int64_t
#endif

#ifndef INCLUDE_ALGEBRAIC_H_
#define INCLUDE_ALGEBRAIC_H_

#ifndef np_int
#ifndef lapack_int
#define np_int int64_t
#else
#define np_int lapack_int
#endif
#endif

/*! \brief Perform in-place matrix inversion.
 *
 * \param mat: `complex double **` The matrix to be inverted (must be a square matrix).
 * \param size: `lapack_int` The size of the matrix (i.e. the number of its rows or columns).
 * \param size: `np_int` The size of the matrix (i.e. the number of its rows or columns).
 * \param ier: `int &` Reference to an integer variable for returning a result flag.
 * \param max_size: `lapack_int` The maximum expected size (required by some call-backs,
 * \param max_size: `np_int` The maximum expected size (required by some call-backs,
 * optional, defaults to 0).
 */
void invert_matrix(dcomplex **mat, np_int size, int &ier, np_int max_size=0);
+7 −1
Original line number Diff line number Diff line
@@ -9,10 +9,16 @@

typedef __complex__ double dcomplex;

#ifdef USE_LAPACK
#ifdef USE_MKL
#include <mkl_lapacke.h>
#else
#include <lapacke.h>
#endif
#ifndef INCLUDE_LAPACK_CALLS_H_
#include "lapacke.h"
#include "../include/lapack_calls.h"
#endif
#endif

#ifndef INCLUDE_ALGEBRAIC_H_
#include "../include/algebraic.h"
+21 −4
Original line number Diff line number Diff line
@@ -4,16 +4,27 @@

typedef __complex__ double dcomplex;

#ifdef USE_LAPACK
#ifdef USE_MKL
#include <mkl_lapacke.h>
#else
#include <lapacke.h>
#endif

#ifndef INCLUDE_LAPACK_CALLS_H_
#include "lapacke.h"
#include "../include/lapack_calls.h"
#endif
#endif

#ifdef USE_LAPACK
void zinvert(dcomplex **mat, lapack_int n, int &jer) {
  jer = 0;
  __complex__ double *arr = new dcomplex[n * n];
  dcomplex *arr = new dcomplex[n * n];
  const dcomplex uim = 0.0 + 1.0 * I;

#ifdef USE_MKL
  MKL_Complex16 *arr2 = (MKL_Complex16 *) arr;
#endif
  for (lapack_int i = 0; i < n; i++) {
    for (lapack_int j = 0; j < n; j++) {
      lapack_int idx = i + n * j;
@@ -23,8 +34,14 @@ void zinvert(dcomplex **mat, lapack_int n, int &jer) {
  
  lapack_int* IPIV = new lapack_int[n]();
  
  if (!LAPACKE_zgetrf(LAPACK_ROW_MAJOR, n, n, arr, n, IPIV)) jer = 1;
  if (!LAPACKE_zgetri(LAPACK_ROW_MAJOR, n, arr, n, IPIV)) jer = 2;
#ifdef USE_MKL
  LAPACKE_zgetrf(LAPACK_ROW_MAJOR, n, n, arr2, n, IPIV);
  LAPACKE_zgetri(LAPACK_ROW_MAJOR, n, arr2, n, IPIV);
#else
  LAPACKE_zgetrf(LAPACK_ROW_MAJOR, n, n, arr, n, IPIV);
  LAPACKE_zgetri(LAPACK_ROW_MAJOR, n, arr, n, IPIV);
#endif

  for (lapack_int i = 0; i < n; i++) {
    for (lapack_int j = 0; j < n; j++) {
      lapack_int idx = i + n * j;
+1 −1
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ override CXXFLAGS=-O3 -ggdb -pg -coverage -I$(HDF5_INCLUDE)
ifdef USE_LAPACK
override CXXFLAGS+= -DUSE_LAPACK -DLAPACK_ILP64 
ifdef USE_MKL
override CXXFLAGS+= -DMKL_ILP64 -I$(MKLROOT)/include
override CXXFLAGS+= -DMKL_ILP64 -DUSE_MKL -I$(MKLROOT)/include
endif
endif
endif