Skip to content

Commit 3185e89

Browse files
committed
remove unused functions
1 parent b62ef9a commit 3185e89

9 files changed

Lines changed: 25 additions & 184 deletions

ChASE-MPI/chase_mpi.hpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -651,26 +651,6 @@ class ChaseMpi : public chase::Chase<T>
651651
}
652652
#endif
653653

654-
// if distributed ChASE is used, collecting the distributed ritz vectors
655-
// into V which is redundant across all MPI ranks. if non-distributed ChASE
656-
// is used, copying Ritz vectors directly to V
657-
//! When distributed ChASE is used, this member function collects the
658-
//! partially distributed Ritz vectors into a redundant vectors `V` on all
659-
//! MPI procs.
660-
//! @param V: the buffer of size `N_xnev_` which stores the collected
661-
//! redundant Ritz vectors.
662-
void collectRitzVecs(T* V)
663-
{
664-
#ifdef USE_NSIGHT
665-
nvtxRangePushA("collectRitzVecs");
666-
#endif
667-
T* Vv = matrices_.get_V1();
668-
dla_->C2V(Vv, 0, V, 0, nev_);
669-
#ifdef USE_NSIGHT
670-
nvtxRangePop();
671-
#endif
672-
}
673-
674654
//! \return `H_`: A pointer to the memory allocated to store (local part if
675655
//! applicable) of matrix `A`.
676656
T* GetMatrixPtr() { return matrices_.get_H(); }

ChASE-MPI/chase_mpidla_interface.hpp

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -129,42 +129,7 @@ class ChaseMpiDLAInterface
129129
*/
130130
virtual void asynCxHGatherC(std::size_t locked, std::size_t block,
131131
bool isCcopied = false) = 0;
132-
133-
//! Copy from buffer rectangular matrix `v1` to `v2`.
134-
//! For the implementation of distributed-memory ChASE, this operation
135-
//! performs a `copy` from a matrix redundantly distributed across all MPI
136-
//! procs to a matrix distributed within each column communicator and
137-
//! redundant among different column communicators. This operation is
138-
//! reciprocal to V2C().
139-
/*!
140-
* @param v1: the buffer to copy from
141-
* @param off1: the offset for the starting column index of `v1` to copy
142-
* from
143-
* @param v2: the buffer to copy to
144-
* @param off2: the offset for the starting column index of `v2` to copy to
145-
* @param block: number of columns to copy from `v1` to `v2`
146-
*/
147-
virtual void C2V(T* v1, std::size_t off1, T* v2, std::size_t off2,
148-
std::size_t block) = 0;
149-
//! Copy from buffer rectangular matrix `v1` to `v2`.
150-
//! For the implementation of distributed-memory ChASE, this operation
151-
//! performs a `copy` from a matrix distributed within each column
152-
//! communicator and redundant among different column communicators to a
153-
//! matrix redundantly distributed across all MPI procs. This operation is
154-
//! reciprocal to C2V(). It requires the `dim_[0]` MPI broadcasting
155-
//! operations, in which `dim_[0]` is the size of each MPI column
156-
//! communicatior.
157-
/*!
158-
* @param v1: the buffer to copy from
159-
* @param off1: the offset for the starting column index of `v1` to copy
160-
* from
161-
* @param v2: the buffer to copy to
162-
* @param off2: the offset for the starting column index of `v2` to copy to
163-
* @param block: number of columns to copy from `v1` to `v2`
164-
*/
165-
virtual void V2C(T* v1, std::size_t off1, T* v2, std::size_t off2,
166-
std::size_t block) = 0;
167-
132+
168133
//! Swap the columns indexing `i` and `j` in a rectangular matrix
169134
//! The operated matrices maybe different in different implementations
170135
/*!

ChASE-MPI/impl/chase_mpidla.hpp

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,11 @@ class ChaseMpiDLA : public ChaseMpiDLAInterface<T>
390390
next_ = NextOp::bAc;
391391
locked_ = locked;
392392

393-
this->V2C(V, locked_, C_, locked_, block);
393+
for (auto j = 0; j < block; j++){
394+
for(auto i = 0; i < mblocks_; i++){
395+
std::memcpy(C_ + j * m_ + r_offs_l_[i], V + j * N_ + locked * N_ + r_offs_[i], r_lens_[i] * sizeof(T));
396+
}
397+
}
394398

395399
dla_->preApplication(V, locked, block);
396400
#ifdef USE_NSIGHT
@@ -471,26 +475,6 @@ class ChaseMpiDLA : public ChaseMpiDLAInterface<T>
471475
nvtxRangePop();
472476
#endif
473477
}
474-
// v1->v2
475-
void V2C(T* v1, std::size_t off1, T* v2, std::size_t off2,
476-
std::size_t block) override
477-
{
478-
#ifdef USE_NSIGHT
479-
nvtxRangePushA("ChaseMpiDLA: V2C");
480-
#endif
481-
for (auto j = 0; j < block; j++)
482-
{
483-
for (auto i = 0; i < mblocks_; i++)
484-
{
485-
std::memcpy(v2 + off2 * m_ + j * m_ + r_offs_l_[i],
486-
v1 + off1 * N_ + j * N_ + r_offs_[i],
487-
r_lens_[i] * sizeof(T));
488-
}
489-
}
490-
#ifdef USE_NSIGHT
491-
nvtxRangePop();
492-
#endif
493-
}
494478

495479
//! collect partially distributed matrices into redundant matrices
496480
//! @param buff the sending buff
@@ -597,24 +581,6 @@ class ChaseMpiDLA : public ChaseMpiDLAInterface<T>
597581
}
598582
}
599583

600-
// v1->v2
601-
void C2V(T* v1, std::size_t off1, T* v2, std::size_t off2,
602-
std::size_t block) override
603-
{
604-
#ifdef USE_NSIGHT
605-
nvtxRangePushA("ChaseMpiDLA: C2V");
606-
#endif
607-
std::size_t dimsIdx = 0;
608-
T* buff = v1 + off1 * m_;
609-
T* targetBuf = v2 + off2 * N_;
610-
611-
this->collecRedundantVecs(buff, targetBuf, dimsIdx, block);
612-
613-
#ifdef USE_NSIGHT
614-
nvtxRangePop();
615-
#endif
616-
}
617-
618584
bool postApplication(T* V, std::size_t block, std::size_t locked) override
619585
{
620586
#ifdef USE_NSIGHT
@@ -1549,12 +1515,8 @@ class ChaseMpiDLA : public ChaseMpiDLAInterface<T>
15491515

15501516
std::fill(v0_, v0_ + m_, T(0));
15511517

1552-
#ifdef USE_NSIGHT
1553-
nvtxRangePushA("C2V");
1554-
#endif
15551518
if(idx >= 0)
15561519
{
1557-
// this->C2V(C2_, idx, v1_, 0, 1);
15581520
std::memcpy(v1_, C2_ + idx * m_, m_ * sizeof(T) );
15591521
}else
15601522
{
@@ -1566,9 +1528,6 @@ class ChaseMpiDLA : public ChaseMpiDLAInterface<T>
15661528
v1_[k] = getRandomT<T>([&]() { return normal_distribution(gen); });
15671529
}
15681530
}
1569-
#ifdef USE_NSIGHT
1570-
nvtxRangePop();
1571-
#endif
15721531
// ENSURE that v1 has one norm
15731532
#ifdef USE_NSIGHT
15741533
nvtxRangePushA("Lanczos: loop");

ChASE-MPI/impl/chase_mpidla_blaslapack.hpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -230,20 +230,7 @@ class ChaseMpiDLABlaslapack : public ChaseMpiDLAInterface<T>
230230
&One, B2_ + locked * n_, n_, B_ + locked * n_, n_, &Zero, A_,
231231
nev_ + nex_);
232232
}
233-
//! - All required operations for this function has been done in for
234-
//! ChaseMpiDLA::V2C().
235-
//! - This function contains nothing in this class.
236-
void V2C(T* v1, std::size_t off1, T* v2, std::size_t off2,
237-
std::size_t block) override
238-
{
239-
}
240-
//! - All required operations for this function has been done in for
241-
//! ChaseMpiDLA::C2V().
242-
//! - This function contains nothing in this class.
243-
void C2V(T* v1, std::size_t off1, T* v2, std::size_t off2,
244-
std::size_t block) override
245-
{
246-
}
233+
247234
//! It is an interface to BLAS `?sy(he)rk`.
248235
void syherk(char uplo, char trans, std::size_t n, std::size_t k, T* alpha,
249236
T* a, std::size_t lda, T* beta, T* c, std::size_t ldc,

ChASE-MPI/impl/chase_mpidla_blaslapack_seq.hpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,7 @@ class ChaseMpiDLABlaslapackSeq : public ChaseMpiDLAInterface<T>
7272
}
7373
}
7474
}
75-
76-
// v1->v2
77-
void V2C(T* v1, std::size_t off1, T* v2, std::size_t off2,
78-
std::size_t block) override
79-
{
80-
std::memcpy(v2 + off2 * N_, v1 + off1 * N_, N_ * block * sizeof(T));
81-
}
82-
83-
// v1->v2;
84-
void C2V(T* v1, std::size_t off1, T* v2, std::size_t off2,
85-
std::size_t block) override
86-
{
87-
std::memcpy(v2 + off2 * N_, v1 + off1 * N_, N_ * block * sizeof(T));
88-
}
89-
75+
9076
void preApplication(T* V, std::size_t const locked,
9177
std::size_t const block) override
9278
{
@@ -369,7 +355,7 @@ class ChaseMpiDLABlaslapackSeq : public ChaseMpiDLAInterface<T>
369355
std::fill(v0_, v0_ + N_, T(0));
370356

371357
#ifdef USE_NSIGHT
372-
nvtxRangePushA("C2V");
358+
nvtxRangePushA("Lanczos Init vec");
373359
#endif
374360
if(idx >= 0)
375361
{
@@ -397,7 +383,7 @@ class ChaseMpiDLABlaslapackSeq : public ChaseMpiDLAInterface<T>
397383
for (std::size_t k = 0; k < M; k = k + 1)
398384
{
399385
if(idx >= 0){
400-
this->V2C(v1_, 0, V12_, k, 1);
386+
std::memcpy(V12_ + k * N_, v1_, N_ * sizeof(T));
401387
}
402388
this->applyVec(v1_, get_V2());
403389
this->B2C(get_V2(), 0, v2_, 0, 1);

ChASE-MPI/impl/chase_mpidla_blaslapack_seq_inplace.hpp

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,7 @@ class ChaseMpiDLABlaslapackSeqInplace : public ChaseMpiDLAInterface<T>
6666
}
6767
}
6868
}
69-
70-
void V2C(T* v1, std::size_t off1, T* v2, std::size_t off2,
71-
std::size_t block) override
72-
{
73-
std::memcpy(v2 + off2 * N_, v1 + off1 * N_, N_ * block * sizeof(T));
74-
}
75-
76-
void C2V(T* v1, std::size_t off1, T* v2, std::size_t off2,
77-
std::size_t block) override
78-
{
79-
std::memcpy(v2 + off2 * N_, v1 + off1 * N_, N_ * block * sizeof(T));
80-
}
81-
69+
8270
void preApplication(T* V, std::size_t locked, std::size_t block) override
8371
{
8472
locked_ = locked;
@@ -312,12 +300,13 @@ class ChaseMpiDLABlaslapackSeqInplace : public ChaseMpiDLAInterface<T>
312300
std::fill(v0_, v0_ + N_, T(0));
313301

314302
#ifdef USE_NSIGHT
315-
nvtxRangePushA("C2V");
303+
nvtxRangePushA("Lanczos Init vec");
316304
#endif
317305
if(idx >= 0)
318306
{
319-
this->C2V(V2_, idx, v1_, 0, 1);
320-
}else
307+
std::memcpy(v1_, V2_ + idx * N_, N_ * sizeof(T));
308+
}
309+
else
321310
{
322311
std::mt19937 gen(2342.0);
323312
std::normal_distribution<> normal_distribution;
@@ -340,8 +329,8 @@ class ChaseMpiDLABlaslapackSeqInplace : public ChaseMpiDLAInterface<T>
340329
for (std::size_t k = 0; k < M; k = k + 1)
341330
{
342331
if(idx >= 0){
343-
this->V2C(v1_, 0, V1_, k, 1);
344-
}
332+
std::memcpy(V1_ + k * N_, v1_, N_ * sizeof(T));
333+
}
345334
this->applyVec(v1_, w_);
346335
alpha = this->dot(N_, v1_, 1, w_, 1);
347336
alpha = -alpha;

ChASE-MPI/impl/chase_mpidla_cuda_seq.hpp

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -251,19 +251,6 @@ class ChaseMpiDLACudaSeq : public ChaseMpiDLAInterface<T>
251251
(cudaStream_t)0);
252252
}
253253

254-
void V2C(T* v1, std::size_t off1, T* v2, std::size_t off2,
255-
std::size_t block) override
256-
{
257-
cuda_exec(cudaMemcpy(v2 + off2 * N_, v1 + off1 * N_,
258-
block * N_ * sizeof(T), cudaMemcpyDeviceToDevice));
259-
}
260-
void C2V(T* v1, std::size_t off1, T* v2, std::size_t off2,
261-
std::size_t block) override
262-
{
263-
cuda_exec(cudaMemcpy(v2 + off2 * N_, v1 + off1 * N_,
264-
block * N_ * sizeof(T), cudaMemcpyDeviceToDevice));
265-
}
266-
267254
void preApplication(T* V, std::size_t locked, std::size_t block) override
268255
{
269256
locked_ = locked;
@@ -483,11 +470,12 @@ class ChaseMpiDLACudaSeq : public ChaseMpiDLAInterface<T>
483470
cudaMemset(v0_, 0, sizeof(T) * N_);
484471

485472
#ifdef USE_NSIGHT
486-
nvtxRangePushA("C2V");
473+
nvtxRangePushA("Lanczos Init Vec");
487474
#endif
488475
if(idx >= 0)
489476
{
490-
this->C2V(d_V2_, idx, v1_, 0, 1);
477+
cuda_exec(cudaMemcpy(v1_, d_V2_ + idx * N_,
478+
N_ * sizeof(T), cudaMemcpyDeviceToDevice));
491479
}else
492480
{
493481
unsigned long long seed = 2342;
@@ -507,8 +495,9 @@ class ChaseMpiDLACudaSeq : public ChaseMpiDLAInterface<T>
507495
for (std::size_t k = 0; k < M; k = k + 1)
508496
{
509497
if(idx >= 0){
510-
this->V2C(v1_, 0, d_V1_, k, 1);
511-
}
498+
cuda_exec(cudaMemcpy(d_V1_ + k * N_, v1_,
499+
N_ * sizeof(T), cudaMemcpyDeviceToDevice));
500+
}
512501
this->applyVec(v1_, w_);
513502
alpha = this->dot(N_, v1_, 1, w_, 1);
514503
alpha = -alpha;

ChASE-MPI/impl/chase_mpidla_mgpu.hpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -554,20 +554,6 @@ class ChaseMpiDLAMultiGPU : public ChaseMpiDLAInterface<T>
554554
nev_ + nex_, A_, nev_ + nex_);
555555
assert(cublas_status_ == CUBLAS_STATUS_SUCCESS);
556556
}
557-
//! - All required operations for this function has been done in for
558-
//! ChaseMpiDLA::V2C().
559-
//! - This function contains nothing in this class.
560-
void V2C(T* v1, std::size_t off1, T* v2, std::size_t off2,
561-
std::size_t block) override
562-
{
563-
}
564-
//! - All required operations for this function has been done in for
565-
//! ChaseMpiDLA::C2V().
566-
//! - This function contains nothing in this class.
567-
void C2V(T* v1, std::size_t off1, T* v2, std::size_t off2,
568-
std::size_t block) override
569-
{
570-
}
571557
//! It is an interface to cuBLAS `cublasXsy(he)rk`.
572558
void syherk(char uplo, char trans, std::size_t n, std::size_t k, T* alpha,
573559
T* a, std::size_t lda, T* beta, T* c, std::size_t ldc,

tests/noinput.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ using namespace chase::mpi;
2828
#if defined(USE_GPU)
2929
typedef ChaseMpi<ChaseMpiDLACudaSeq, T> CHASE;
3030
#else
31-
typedef ChaseMpi<ChaseMpiDLABlaslapackSeq, T> CHASE;
32-
//typedef ChaseMpi<ChaseMpiDLABlaslapackSeqInplace, T> CHASE;
31+
//typedef ChaseMpi<ChaseMpiDLABlaslapackSeq, T> CHASE;
32+
typedef ChaseMpi<ChaseMpiDLABlaslapackSeqInplace, T> CHASE;
3333
#endif
3434

3535
int main()

0 commit comments

Comments
 (0)