forked from abacusmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Porting abacus to DSP hardware (mtblas part) (#5301)
* Link mtblas library * Add mtblas gemm kernel usage * Finish memory_op on dsp * Update CMakeLists * Add compilation script * Fix warnings * Fix install script * Initialize DSP hardware * Replace gemm in math_kernel * Fix CMakeLists Bug * Fix bugs #1 * Fix bug 2 * Fix link to shared library error * Stop use gemm_mt globally * Modify op usage * Fix bug * Fix template usage * Fix compilation * Replace all dav_subspace gemm kernels --------- Co-authored-by: Mohan Chen <mohanchen@pku.edu.cn>
- Loading branch information
1 parent
2af2095
commit f039250
Showing
10 changed files
with
251 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CXX=mpicxx \ | ||
cmake -B build \ | ||
-DUSE_DSP=ON \ | ||
-DENABLE_LCAO=OFF \ | ||
-DFFTW3_DIR=/vol8/appsoftware/fftw/ \ | ||
-DFFTW3_LIBRARY=/vol8/appsoftware/fftw/lib/libfftw3.so \ | ||
-DFFTW3_OMP_LIBRARY=/vol8/appsoftware/fftw/lib/libfftw3_omp.so \ | ||
-DFFTW3_FLOAT_LIBRARY=/vol8/appsoftware/fftw/lib/libfftw3f.so \ | ||
-DLAPACK_DIR=/vol8/appsoftware/openblas/0.3.21/lib \ | ||
-DDIR_MTBLAS_LIBRARY=/vol8/home/dptech_zyz1/develop/packages/libmtblas_abacus.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#ifndef DSP_CONNECTOR_H | ||
#define DSP_CONNECTOR_H | ||
#ifdef __DSP | ||
|
||
// Base dsp functions | ||
void dspInitHandle(int id); | ||
void dspDestoryHandle(); | ||
void *malloc_ht(size_t bytes); | ||
void free_ht(void* ptr); | ||
|
||
|
||
// mtblas functions | ||
|
||
void sgemm_mt_(const char *transa, const char *transb, | ||
const int *m, const int *n, const int *k, | ||
const float *alpha, const float *a, const int *lda, | ||
const float *b, const int *ldb, const float *beta, | ||
float *c, const int *ldc); | ||
|
||
void dgemm_mt_(const char *transa, const char *transb, | ||
const int *m, const int *n, const int *k, | ||
const double *alpha,const double *a, const int *lda, | ||
const double *b, const int *ldb, const double *beta, | ||
double *c, const int *ldc); | ||
|
||
void zgemm_mt_(const char *transa, const char *transb, | ||
const int *m, const int *n, const int *k, | ||
const std::complex<double> *alpha, const std::complex<double> *a, const int *lda, | ||
const std::complex<double> *b, const int *ldb, const std::complex<double> *beta, | ||
std::complex<double> *c, const int *ldc); | ||
|
||
void cgemm_mt_(const char *transa, const char *transb, | ||
const int *m, const int *n, const int *k, | ||
const std::complex<float> *alpha, const std::complex<float> *a, const int *lda, | ||
const std::complex<float> *b, const int *ldb, const std::complex<float> *beta, | ||
std::complex<float> *c, const int *ldc); | ||
|
||
|
||
void sgemm_mth_(const char *transa, const char *transb, | ||
const int *m, const int *n, const int *k, | ||
const float *alpha, const float *a, const int *lda, | ||
const float *b, const int *ldb, const float *beta, | ||
float *c, const int *ldc); | ||
|
||
void dgemm_mth_(const char *transa, const char *transb, | ||
const int *m, const int *n, const int *k, | ||
const double *alpha,const double *a, const int *lda, | ||
const double *b, const int *ldb, const double *beta, | ||
double *c, const int *ldc); | ||
|
||
void zgemm_mth_(const char *transa, const char *transb, | ||
const int *m, const int *n, const int *k, | ||
const std::complex<double> *alpha, const std::complex<double> *a, const int *lda, | ||
const std::complex<double> *b, const int *ldb, const std::complex<double> *beta, | ||
std::complex<double> *c, const int *ldc); | ||
|
||
void cgemm_mth_(const char *transa, const char *transb, | ||
const int *m, const int *n, const int *k, | ||
const std::complex<float> *alpha, const std::complex<float> *a, const int *lda, | ||
const std::complex<float> *b, const int *ldb, const std::complex<float> *beta, | ||
std::complex<float> *c, const int *ldc); | ||
|
||
//#define zgemm_ zgemm_mt | ||
|
||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ enum AbacusDevice_t | |
UnKnown, | ||
CpuDevice, | ||
GpuDevice, | ||
DspDevice | ||
}; | ||
|
||
} // namespace base_device | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.