Skip to content

Code Quality: yet another blas in elpa solver #5990

@Cstandardlib

Description

@Cstandardlib

Describe the Code Quality Issue

Look! I have found yet another blas in our code, that is my_math.

When I try to import into source/module_hsolver/genelpa/elpa_new_complex.cpp

#include "module_base/global_function.h"    // TO_STRING
#include "module_base/tool_quit.h"          // WARNNING_QUIT

to pop warning and quit for failed decomposition, compilation errors popped and reminded me that

error: conflicting declaration of C function ‘void dcopy_(const long int*, const double*, const int*, double*, const int*)’
   27 |         void dcopy_(long const *n, const double *a, int const *incx, double *b, int const *incy);
      |              ^~~~~~

dcopy and suchlike defined in source/module_hsolver/genelpa/my_math.hpp and source/module_base/blas_connector.h confilct with each other.

  1. I need to import TO_STRING utility to an integer return value into string, while this module_base/global_function.h containing it includes blas_connector.h to provide zcopy, dcopy etc.
  2. This genelpa folder has its own math, called my_math (with its blas):
➜  genelpa ✗ ls
blas.h    CMakeLists.txt    elpa_new_complex.cpp  elpa_new.h         elpa_solver.h  pblas.h  scalapack.h  utils.h
Cblacs.h  elpa_generic.hpp  elpa_new.cpp          elpa_new_real.cpp  my_math.hpp    README   utils.cpp
// source/module_hsolver/genelpa/my_math.hpp
{
#include "Cblacs.h"
#include "blas.h"
#include "pblas.h"
#include "scalapack.h"

}

More and more blas-like headers. Local blas.
These blas confilct with each other.

For the welfare of developers, I proposed to eliminate this terrible presence from the codebase.

Additional Context

No response

Task list for Issue attackers (only for developers)

  • Identify the specific code file or section with the code quality issue.
  • Investigate the issue and determine the root cause.
  • Research best practices and potential solutions for the identified issue.
  • Refactor the code to improve code quality, following the suggested solution.
  • Ensure the refactored code adheres to the project's coding standards.
  • Test the refactored code to ensure it functions as expected.
  • Update any relevant documentation, if necessary.
  • Submit a pull request with the refactored code and a description of the changes made.

Metadata

Metadata

Assignees

Labels

GPU & DCU & HPCGPU and DCU and HPC related any issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions