Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions source/source_hsolver/module_genelpa/cblacs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@
#define ABACUS_SOURCE_HSOLVER_MODULE_GENELPA_CBLACS_H

// blacs
// Initialization
// Initialization
#include "mpi.h"

#include <complex>
int Csys2blacs_handle(MPI_Comm SysCtxt);
void Cblacs_pinfo(int *myid, int *nprocs);
void Cblacs_get(int icontxt, int what, int *val);
void Cblacs_gridinit(int* icontxt, char *layout, int nprow, int npcol);
void Cblacs_gridmap(int* icontxt, int *usermap, int ldumap, int nprow, int npcol);
// Destruction
void Cblacs_pinfo(int* myid, int* nprocs);
void Cblacs_get(int icontxt, int what, int* val);
void Cblacs_gridinit(int* icontxt, char* layout, int nprow, int npcol);
void Cblacs_gridmap(int* icontxt, int* usermap, int ldumap, int nprow, int npcol);
// Destruction
void Cblacs_gridexit(int icontxt);
// Informational and Miscellaneous
void Cblacs_gridinfo(int icontxt, int* nprow, int *npcol, int *myprow, int *mypcol);
// Informational and Miscellaneous
void Cblacs_gridinfo(int icontxt, int* nprow, int* npcol, int* myprow, int* mypcol);
int Cblacs_pnum(int icontxt, int prow, int pcol);
void Cblacs_pcoord(int icontxt, int pnum, int *prow, int *pcol);
void Cblacs_barrier(int icontxt, char *scope);
// Point to Point
void Cdgesd2d(int icontxt, int m, int n, double *a, int lda, int rdest, int cdest);
void Cdgerv2d(int icontxt, int m, int n, double *a, int lda, int rsrc, int csrc);
void Czgesd2d(int icontxt, int m, int n, std::complex<double> *a, int lda, int rdest, int cdest);
void Czgerv2d(int icontxt, int m, int n, std::complex<double> *a, int lda, int rsrc, int csrc);
// Combine
//void Cdgamx2d(int icontxt, int scope, int top, int m, int n,
// double *a, int lda, int *ra, int *ca, int rcflag, int rdest, int cdest);
void Cblacs_pcoord(int icontxt, int pnum, int* prow, int* pcol);
void Cblacs_barrier(int icontxt, char* scope);
// Point to Point
void Cdgesd2d(int icontxt, int m, int n, double* a, int lda, int rdest, int cdest);
void Cdgerv2d(int icontxt, int m, int n, double* a, int lda, int rsrc, int csrc);
void Czgesd2d(int icontxt, int m, int n, std::complex<double>* a, int lda, int rdest, int cdest);
void Czgerv2d(int icontxt, int m, int n, std::complex<double>* a, int lda, int rsrc, int csrc);
// Combine
// void Cdgamx2d(int icontxt, int scope, int top, int m, int n,
// double *a, int lda, int *ra, int *ca, int rcflag, int rdest, int cdest);

#endif // ABACUS_SOURCE_HSOLVER_MODULE_GENELPA_CBLACS_H
435 changes: 316 additions & 119 deletions source/source_hsolver/module_genelpa/elpa_generic.h

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions source/source_hsolver/module_genelpa/elpa_new.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "elpa_new.h"

#include "elpa_runtime_check.h"

#include "elpa_solver.h"
extern "C"
{
#include "cblacs.h"
}
#include "utils.h"

#include <cfloat>
#include <complex>
#include <cstring>
Expand Down Expand Up @@ -73,8 +73,8 @@ ELPA_Solver::ELPA_Solver(const bool isReal,

handle_id = ++total_handle;

//delete the old elpa_handle and reuse the handle_id=0
if(reuse_handle_0 && total_handle>0)
// delete the old elpa_handle and reuse the handle_id=0
if (reuse_handle_0 && total_handle > 0)
{
NEW_ELPA_HANDLE_POOL.erase(0);
handle_id = 0;
Expand Down Expand Up @@ -463,7 +463,7 @@ int ELPA_Solver::read_complex_kernel()
int ELPA_Solver::allocate_work()
{
unsigned long nloc = static_cast<unsigned long>(narows) * nacols; // local size
unsigned long maxloc = 0; // maximum local size
unsigned long maxloc = 0; // maximum local size
MPI_Allreduce(&nloc, &maxloc, 1, MPI_UNSIGNED_LONG, MPI_MAX, comm);
maxloc = nloc;

Expand All @@ -480,13 +480,13 @@ void ELPA_Solver::timer(int myid, const char function[], const char step[], doub
if (t0 < 0) // t0 < 0 means this is the init call before the function
{
t0 = MPI_Wtime();
t0 = (double)clock()/CLOCKS_PER_SEC;
t0 = (double)clock() / CLOCKS_PER_SEC;
logfile << "DEBUG: Process " << myid << " Call " << function << std::endl;
}
else
{
t1 = MPI_Wtime();
t1 = (double)clock()/CLOCKS_PER_SEC;
t1 = (double)clock() / CLOCKS_PER_SEC;
logfile << "DEBUG: Process " << myid << " Step " << step << " " << function << " time: " << t1 - t0 << " s"
<< std::endl;
}
Expand Down
9 changes: 3 additions & 6 deletions source/source_hsolver/module_genelpa/elpa_new.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#ifndef ABACUS_SOURCE_HSOLVER_MODULE_GENELPA_ELPA_NEW_H
#define ABACUS_SOURCE_HSOLVER_MODULE_GENELPA_ELPA_NEW_H


#include <elpa/elpa_version.h>



#if ELPA_API_VERSION >= 20221101
#include <elpa/elpa.h>
#else
Expand All @@ -14,10 +11,10 @@ extern "C"
#include <limits.h>

struct elpa_struct;
typedef struct elpa_struct *elpa_t;
typedef struct elpa_struct* elpa_t;

struct elpa_autotune_struct;
typedef struct elpa_autotune_struct *elpa_autotune_t;
typedef struct elpa_autotune_struct* elpa_autotune_t;

#include <elpa/elpa_constants.h>
#include <elpa/elpa_generated_c_api.h>
Expand All @@ -30,7 +27,7 @@ extern "C"
// #include <elpa/elpa_generic.h>
#undef complex

const char *elpa_strerr(int elpa_error);
const char* elpa_strerr(int elpa_error);

// This is a header file related to GPU support.
// This header file was not available in the early ELPA.
Expand Down
Loading
Loading