Commit 80a79af1 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Compile with 64-bit LAPACK headers

parent ffbff0ca
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -46,7 +46,7 @@ $(BUILDDIR_CLU)/edfb_clu: $(OBJDIR) $(OBJDIR)/edfb_clu.o $(BUILDDIR_CLU)


# We put $(LIBNPTM) as an object to link in directly, so that it will be found at runtime even if it is a shared object library. May change in the future when we have an install: target
# We put $(LIBNPTM) as an object to link in directly, so that it will be found at runtime even if it is a shared object library. May change in the future when we have an install: target
$(BUILDDIR_CLU)/np_cluster: $(OBJDIR) $(CXX_CLU_OBJS) $(BUILDDIR_CLU) $(LIBNPTM)
$(BUILDDIR_CLU)/np_cluster: $(OBJDIR) $(CXX_CLU_OBJS) $(BUILDDIR_CLU) $(LIBNPTM)
	$(CXX) $(CXXFLAGS) -o $(BUILDDIR_CLU)/np_cluster $(CXX_CLU_OBJS) $(LIBNPTM) $(CXXLDFLAGS) -llapacke
	$(CXX) $(CXXFLAGS) -o $(BUILDDIR_CLU)/np_cluster $(CXX_CLU_OBJS) $(LIBNPTM) $(CXXLDFLAGS)


clean:
clean:
	rm -f $(F_CLU_OBJS) $(CXX_CLU_OBJS) $(CXX_CLU_DEBUG)
	rm -f $(F_CLU_OBJS) $(CXX_CLU_OBJS) $(CXX_CLU_DEBUG)
+2 −1
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@
#endif
#endif


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


@@ -340,7 +341,7 @@ void cluster(string config_file, string data_file, string output_path) {
	} // i132 loop
	} // i132 loop
	cms(am, c1, c1ao, c4, c6);
	cms(am, c1, c1ao, c4, c6);
	//cms(tam, c1, c1ao, c4, c6);
	//cms(tam, c1, c1ao, c4, c6);
	int ndit = 2 * nsph * c4->nlim;
	lapack_int ndit = 2 * nsph * c4->nlim;
	//lucin(am, mxndm, ndit, jer);
	//lucin(am, mxndm, ndit, jer);
	zinvert(am, ndit, jer);
	zinvert(am, ndit, jer);
	if (jer != 0) break; // jxi488 loop: goes to memory clean
	if (jer != 0) break; // jxi488 loop: goes to memory clean
+1 −1
Original line number Original line Diff line number Diff line
@@ -16,6 +16,6 @@
 * \param n: `int` The number of rows and columns of the [n x n] matrix.
 * \param n: `int` The number of rows and columns of the [n x n] matrix.
 * \param jer: `int &` Reference to an integer return flag.
 * \param jer: `int &` Reference to an integer return flag.
 */
 */
void zinvert(std::complex<double> **mat, int n, int &jer);
void zinvert(std::complex<double> **mat, lapack_int n, int &jer);


#endif
#endif
+9 −9
Original line number Original line Diff line number Diff line
#include <complex>
#include <complex>
#include <cstdlib>
#include <cstdlib>
#include "lapacke.h"


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


using namespace std;
using namespace std;


void zinvert(std::complex<double> **mat, int n, int &jer) {
void zinvert(std::complex<double> **mat, lapack_int n, int &jer) {
  jer = 0;
  jer = 0;
  __complex__ double *arr = new __complex__ double[n * n];
  __complex__ double *arr = new __complex__ double[n * n];
  const __complex__ double uim = 1.0di;
  const __complex__ double uim = 1.0di;
  for (int i = 0; i < n; i++) {
  for (lapack_int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
    for (lapack_int j = 0; j < n; j++) {
      int idx = i + n * j;
      lapack_int idx = i + n * j;
      arr[idx] = mat[j][i].real() + uim * mat[j][i].imag();
      arr[idx] = mat[j][i].real() + uim * mat[j][i].imag();
    }
    }
  }
  }
  
  
  int* IPIV = new int[n];
  int* IPIV = new int[n]();
  
  
  LAPACKE_zgetrf(LAPACK_ROW_MAJOR, n, n, arr, n, IPIV);
  LAPACKE_zgetrf(LAPACK_ROW_MAJOR, n, n, arr, n, IPIV);
  LAPACKE_zgetri(LAPACK_ROW_MAJOR, n, arr, n, IPIV);
  LAPACKE_zgetri(LAPACK_ROW_MAJOR, n, arr, n, IPIV);
  for (int i = 0; i < n; i++) {
  for (lapack_int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
    for (lapack_int j = 0; j < n; j++) {
      int idx = i + n * j;
      lapack_int idx = i + n * j;
      mat[j][i] = complex<double>(__real__ arr[idx], __imag__ arr[idx]);
      mat[j][i] = complex<double>(__real__ arr[idx], __imag__ arr[idx]);
    }
    }
  }
  }
+2 −2
Original line number Original line Diff line number Diff line
@@ -40,7 +40,7 @@ endif


# CXXFLAGS defines the default compilation options for the C++ compiler
# CXXFLAGS defines the default compilation options for the C++ compiler
ifndef CXXFLAGS
ifndef CXXFLAGS
override CXXFLAGS=-O3 -ggdb -pg -coverage -I$(HDF5_INCLUDE)
override CXXFLAGS=-O3 -ggdb -pg -coverage -I$(HDF5_INCLUDE) -DLAPACK_ILP64
#override CXXFLAGS=-O3 -I$(HDF5_INCLUDE)
#override CXXFLAGS=-O3 -I$(HDF5_INCLUDE)
endif
endif


@@ -50,7 +50,7 @@ ifndef CXXLDFLAGS
ifndef HDF5_LIB
ifndef HDF5_LIB
override HDF5_LIB=/usr/lib/x86_64-linux-gnu/hdf5/serial
override HDF5_LIB=/usr/lib/x86_64-linux-gnu/hdf5/serial
endif
endif
override CXXLDFLAGS=-L/usr/lib64 -L$(HDF5_LIB) -lhdf5 $(LDFLAGS)
override CXXLDFLAGS=-L/usr/lib64 -L$(HDF5_LIB) -lhdf5 -llapacke $(LDFLAGS)
#else
#else
#override CXXLDFLAGS=-L/usr/lib64 -L$(HDF5_LIB) -lhdf5 $(CXXLDFLAGS)
#override CXXLDFLAGS=-L/usr/lib64 -L$(HDF5_LIB) -lhdf5 $(CXXLDFLAGS)
endif
endif