Skip to content

Commit 77a8de3

Browse files
author
Martin D. Weinberg
committed
Use either pcavar or nint>0 to trigger covar computation
1 parent f3dd467 commit 77a8de3

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/cudaCylinder.cu

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ void Cylinder::cuda_zero_coefs()
898898

899899
// Resize and zero PCA arrays
900900
//
901-
if (pcavar) {
901+
if (pcavar or (nint>0)) {
902902
// (Re)initialize?
903903
if (cuS.T_covr.size() != sampT) {
904904
cuS.T_covr.resize(sampT);
@@ -956,7 +956,7 @@ void Cylinder::determine_coefficients_cuda()
956956
// Variance components
957957
host_covar.resize((mmax+1)*nmax*nmax);
958958

959-
if (pcavar) { // Set sample size
959+
if (pcavar or (nint>0)) { // Set sample size
960960
if (defSampT) sampT = defSampT;
961961
else sampT = floor(sqrt(component->CurTotal()));
962962
host_coefsT.resize(sampT); // Modulus components
@@ -1011,7 +1011,7 @@ void Cylinder::determine_coefficients_cuda()
10111011
//
10121012
thrust::fill(host_coefs.begin(), host_coefs.end(), 0.0);
10131013

1014-
if (pcavar) {
1014+
if (pcavar or (nint>0)) {
10151015
for (int T=0; T<sampT; T++) {
10161016
thrust::fill(host_coefsT[T].begin(), host_coefsT[T].end(), 0.0);
10171017
thrust::fill(host_covarT[T].begin(), host_covarT[T].end(), 0.0);
@@ -1092,7 +1092,7 @@ void Cylinder::determine_coefficients_cuda()
10921092
// Adjust cached storage, if necessary
10931093
//
10941094
cuS.resize_coefs(nmax, mmax, N, gridSize, stride,
1095-
sampT, pcavar, pcaeof, subsamp);
1095+
sampT, pcavar or (nint>0), pcaeof, subsamp);
10961096

10971097
// Shared memory size for the reduction
10981098
//
@@ -1115,7 +1115,7 @@ void Cylinder::determine_coefficients_cuda()
11151115
auto begV = cuS.df_tvar.begin();
11161116
std::vector<thrust::device_vector<cuFP_t>::iterator> bg, bh;
11171117

1118-
if (pcavar) {
1118+
if (pcavar or (nint > 0)) {
11191119
for (int T=0; T<sampT; T++) {
11201120
bh.push_back(cuS.T_covr[T].begin());
11211121
}
@@ -1166,7 +1166,7 @@ void Cylinder::determine_coefficients_cuda()
11661166

11671167
// Reuse dN_coef and use dN_tvar to create sampT partitions
11681168
//
1169-
if (pcavar) {
1169+
if (pcavar or (nint>0)) {
11701170

11711171
int sN = N/sampT;
11721172
int nT = sampT;
@@ -1353,7 +1353,7 @@ void Cylinder::determine_coefficients_cuda()
13531353

13541354
// Variance computation
13551355
//
1356-
if (pcavar) {
1356+
if (pcavar or (nint>0)) {
13571357

13581358
for (int T=0; T<sampT; T++) {
13591359

@@ -1886,9 +1886,10 @@ void Cylinder::DtoH_coefs(int M)
18861886
// n loop
18871887
//
18881888
for (int n=0; n<nmax; n++) {
1889+
18891890
if (pcaeof)
18901891
ortho->set_coefT(T, m, n) += host_coefsT[T][Jmn(m, n, nmax)];
1891-
else
1892+
else
18921893
*ortho->set_VC(T, m, n) += host_coefsT[T][Jmn(m, n, nmax)];
18931894

18941895
// o loop
@@ -1991,7 +1992,7 @@ void Cylinder::multistep_update_cuda()
19911992
// Adjust cached storage, if necessary
19921993
//
19931994
cuS.resize_coefs(nmax, mmax, N, gridSize, stride,
1994-
sampT, pcavar, pcaeof, subsamp);
1995+
sampT, pcavar or (nint>0), pcaeof, subsamp);
19951996

19961997
// Shared memory size for the reduction
19971998
//

0 commit comments

Comments
 (0)