Skip to content

Commit 934a52b

Browse files
committed
Compilation fixed for newer versions of gcc, cuda, libxc and boost
1 parent c22a540 commit 934a52b

40 files changed

+3703
-3104
lines changed

CMakeLists.txt

+37-26
Original file line numberDiff line numberDiff line change
@@ -208,57 +208,68 @@ SET(TARGET_SRC
208208
./src/pseudo/oncv/atomCenteredPostProcessing.cc)
209209

210210
IF ("${GPU_LANG}" STREQUAL "cuda")
211-
211+
SET(DEVICE_HOST_SRC
212+
./src/linAlg/linearAlgebraOperationsDevice.cc
213+
./utils/constraintMatrixInfoDevice.cc
214+
./src/dft/solveVselfInBinsDevice.cc
215+
./src/linAlg/pseudoGSDevice.cc
216+
./src/linAlg/rayleighRitzDevice.cc
217+
./src/poisson/poissonSolverProblemDevice.cc
218+
./src/helmholtz/kerkerSolverProblemDevice.cc
219+
./src/solvers/eigenSolvers/chebyshevOrthogonalizedSubspaceIterationSolverDevice.cc
220+
./src/solvers/linearSolverDevice.cc
221+
./src/solvers/linearSolverProblemDevice.cc
222+
./src/solvers/linearSolverCGDevice.cc
223+
)
212224
SET(DEVICE_SRC
213225
./utils/MemoryTransferKernelsDevice.cc
214226
./utils/DeviceKernelsGeneric.cc
215227
./utils/DeviceDirectCCLWrapper.cc
216228
./src/dft/densityCalculatorDeviceKernels.cc
217229
./src/dft/densityFirstOrderResponseCalculatorDeviceKernels.cc
218-
./src/dft/solveVselfInBinsDevice.cc
230+
./src/dft/solveVselfInBinsDeviceKernels.cc
219231
./src/dft/kineticEnergyDensityCalculatorDeviceKernels.cc
220-
./src/solvers/eigenSolvers/chebyshevOrthogonalizedSubspaceIterationSolverDevice.cc
221-
./src/linAlg/linearAlgebraOperationsDevice.cc
222-
./src/linAlg/pseudoGSDevice.cc
223-
./src/linAlg/rayleighRitzDevice.cc
232+
./src/linAlg/linearAlgebraOperationsDeviceKernels.cc
224233
./src/force/forceWfcContractionsDeviceKernels.cc
225-
./utils/constraintMatrixInfoDevice.cc
234+
./utils/constraintMatrixInfoDeviceKernels.cc
226235
./utils/DeviceAPICalls.cu.cc
227236
./utils/BLASWrapperDevice.cu.cc
228237
./utils/MPICommunicatorP2PKernelsDevice.cc
229-
./src/solvers/linearSolverDevice.cc
230-
./src/solvers/linearSolverCGDevice.cc
231-
./src/solvers/linearSolverProblemDevice.cc
232-
./src/poisson/poissonSolverProblemDevice.cc
233-
./src/helmholtz/kerkerSolverProblemDevice.cc
238+
./src/solvers/linearSolverCGDeviceKernels.cc
239+
./src/poisson/poissonSolverProblemDeviceKernels.cc
234240
./utils/FEBasisOperationsKernelsInternalDevice.cc
235241
./src/atom/AtomicCenteredNonLocalOperatorKernelsDevice.cc
236242
)
237-
238243
ELSEIF ("${GPU_LANG}" STREQUAL "hip")
239-
244+
SET(DEVICE_HOST_SRC
245+
./src/linAlg/linearAlgebraOperationsDevice.cc
246+
./utils/constraintMatrixInfoDevice.cc
247+
./src/dft/solveVselfInBinsDevice.cc
248+
./src/linAlg/pseudoGSDevice.cc
249+
./src/linAlg/rayleighRitzDevice.cc
250+
./src/poisson/poissonSolverProblemDevice.cc
251+
./src/helmholtz/kerkerSolverProblemDevice.cc
252+
./src/solvers/eigenSolvers/chebyshevOrthogonalizedSubspaceIterationSolverDevice.cc
253+
./src/solvers/linearSolverDevice.cc
254+
./src/solvers/linearSolverProblemDevice.cc
255+
./src/solvers/linearSolverCGDevice.cc
256+
)
240257
SET(DEVICE_SRC
241258
./utils/MemoryTransferKernelsDevice.cc
242259
./utils/DeviceKernelsGeneric.cc
243260
./utils/DeviceDirectCCLWrapper.cc
244261
./src/dft/densityCalculatorDeviceKernels.cc
245262
./src/dft/densityFirstOrderResponseCalculatorDeviceKernels.cc
246-
./src/dft/solveVselfInBinsDevice.cc
263+
./src/dft/solveVselfInBinsDeviceKernels.cc
247264
./src/dft/kineticEnergyDensityCalculatorDeviceKernels.cc
248-
./src/solvers/eigenSolvers/chebyshevOrthogonalizedSubspaceIterationSolverDevice.cc
249-
./src/linAlg/linearAlgebraOperationsDevice.cc
250-
./src/linAlg/pseudoGSDevice.cc
251-
./src/linAlg/rayleighRitzDevice.cc
265+
./src/linAlg/linearAlgebraOperationsDeviceKernels.cc
252266
./src/force/forceWfcContractionsDeviceKernels.cc
253-
./utils/constraintMatrixInfoDevice.cc
267+
./utils/constraintMatrixInfoDeviceKernels.cc
254268
./utils/DeviceAPICalls.hip.cc
255269
./utils/BLASWrapperDevice.hip.cc
256270
./utils/MPICommunicatorP2PKernelsDevice.cc
257-
./src/solvers/linearSolverDevice.cc
258-
./src/solvers/linearSolverCGDevice.cc
259-
./src/solvers/linearSolverProblemDevice.cc
260-
./src/poisson/poissonSolverProblemDevice.cc
261-
./src/helmholtz/kerkerSolverProblemDevice.cc
271+
./src/solvers/linearSolverCGDeviceKernels.cc
272+
./src/poisson/poissonSolverProblemDeviceKernelss.cc
262273
./utils/FEBasisOperationsKernelsInternalDevice.cc
263274
./src/atom/AtomicCenteredNonLocalOperatorKernelsDevice.cc
264275
)
@@ -279,7 +290,7 @@ IF (WITH_GPU)
279290
ENDIF()
280291
ENDIF()
281292
IF (WITH_GPU)
282-
LIST(APPEND TARGET_SRC ${DEVICE_SRC})
293+
LIST(APPEND TARGET_SRC ${DEVICE_HOST_SRC} ${DEVICE_SRC})
283294
ENDIF()
284295

285296

include/AtomicCenteredNonLocalOperatorKernelsDevice.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <DeviceDataTypeOverloads.h>
2525
#include <DeviceTypeConfig.h>
2626
#include <DeviceKernelLauncherConstants.h>
27-
27+
#include <MemoryStorage.h>
2828
namespace dftfe
2929
{
3030
namespace AtomicCenteredNonLocalOperatorKernelsDevice

include/BLASWrapper.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
#include <TypeConfig.h>
2525
#include <DeviceTypeConfig.h>
2626
#include <cmath>
27-
27+
#if defined(DFTFE_WITH_DEVICE)
28+
# include "Exceptions.h"
29+
#endif
2830
namespace dftfe
2931
{
3032
namespace linearAlgebra
@@ -665,6 +667,7 @@ namespace dftfe
665667
private:
666668
};
667669
#if defined(DFTFE_WITH_DEVICE)
670+
# include "Exceptions.h"
668671
enum class tensorOpDataType
669672
{
670673
fp32,

include/KohnShamHamiltonianOperator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ namespace dftfe
204204

205205
void
206206
setVEffExternalPotCorrToZero();
207-
private:
208207

208+
private:
209209
std::shared_ptr<
210210
AtomicCenteredNonLocalOperator<dataTypes::number, memorySpace>>
211211
d_ONCVnonLocalOperator;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#ifndef constraintMatrixInfoDeviceKernels_H
2+
#define constraintMatrixInfoDeviceKernels_H
3+
#include <DeviceAPICalls.h>
4+
#include <DeviceDataTypeOverloads.h>
5+
#include <DeviceKernelLauncherConstants.h>
6+
7+
8+
namespace dftfe
9+
{
10+
// Declare dftUtils functions
11+
namespace dftUtils
12+
{
13+
template <typename ValueType>
14+
void
15+
distributeDevice(
16+
const unsigned int contiguousBlockSize,
17+
ValueType * xVec,
18+
const unsigned int *constraintLocalRowIdsUnflattened,
19+
const unsigned int numConstraints,
20+
const unsigned int *constraintRowSizes,
21+
const unsigned int *constraintRowSizesAccumulated,
22+
const unsigned int *constraintLocalColumnIdsAllRowsUnflattened,
23+
const double * constraintColumnValuesAllRowsUnflattened,
24+
const double * inhomogenities);
25+
26+
template <typename ValueType>
27+
void
28+
distributeSlaveToMasterAtomicAddDevice(
29+
const unsigned int contiguousBlockSize,
30+
ValueType * xVec,
31+
const unsigned int *constraintLocalRowIdsUnflattened,
32+
const unsigned int numConstraints,
33+
const unsigned int *constraintRowSizes,
34+
const unsigned int *constraintRowSizesAccumulated,
35+
const unsigned int *constraintLocalColumnIdsAllRowsUnflattened,
36+
const double * constraintColumnValuesAllRowsUnflattened);
37+
38+
template <typename ValueType>
39+
void
40+
setzeroDevice(const unsigned int contiguousBlockSize,
41+
ValueType * xVec,
42+
const unsigned int *constraintLocalRowIdsUnflattened,
43+
const unsigned int numConstraints);
44+
void
45+
scaleConstraintsDevice(
46+
const double * xVec,
47+
const unsigned int *constraintLocalRowIdsUnflattened,
48+
const unsigned int numConstraints,
49+
const unsigned int *constraintRowSizes,
50+
const unsigned int *constraintRowSizesAccumulated,
51+
const unsigned int *constraintLocalColumnIdsAllRowsUnflattened,
52+
double * constraintColumnValuesAllRowsUnflattened);
53+
} // namespace dftUtils
54+
} // namespace dftfe
55+
#endif

include/densityCalculator.h

+2-29
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <headers.h>
2222
#include "dftParameters.h"
2323
#include "FEBasisOperations.h"
24-
24+
#include "densityCalculatorDeviceKernels.h"
2525
namespace dftfe
2626
{
2727
template <typename NumberType, dftfe::utils::MemorySpace memorySpace>
@@ -59,15 +59,12 @@ namespace dftfe
5959
template <typename NumberType>
6060
void
6161
computeRhoGradRhoFromInterpolatedValues(
62-
std::shared_ptr<
63-
dftfe::basis::
64-
FEBasisOperations<NumberType, double, dftfe::utils::MemorySpace::HOST>>
65-
&basisOperationsPtr,
6662
std::shared_ptr<
6763
dftfe::linearAlgebra::BLASWrapper<dftfe::utils::MemorySpace::HOST>>
6864
& BLASWrapperPtr,
6965
const std::pair<unsigned int, unsigned int> cellRange,
7066
const std::pair<unsigned int, unsigned int> vecRange,
67+
const unsigned int nQuadsPerCell,
7168
double * partialOccupVec,
7269
NumberType * wfcQuadPointData,
7370
NumberType * gradWfcQuadPointData,
@@ -77,29 +74,5 @@ namespace dftfe
7774
double * gradRho,
7875
const bool isEvaluateGradRho);
7976

80-
#if defined(DFTFE_WITH_DEVICE)
81-
template <typename NumberType>
82-
void
83-
computeRhoGradRhoFromInterpolatedValues(
84-
std::shared_ptr<
85-
dftfe::basis::FEBasisOperations<NumberType,
86-
double,
87-
dftfe::utils::MemorySpace::DEVICE>>
88-
&basisOperationsPtr,
89-
std::shared_ptr<
90-
dftfe::linearAlgebra::BLASWrapper<dftfe::utils::MemorySpace::DEVICE>>
91-
& BLASWrapperPtr,
92-
const std::pair<unsigned int, unsigned int> cellRange,
93-
const std::pair<unsigned int, unsigned int> vecRange,
94-
double * partialOccupVec,
95-
NumberType * wfcQuadPointData,
96-
NumberType * gradWfcQuadPointData,
97-
double * rhoCellsWfcContributions,
98-
double * gradRhoCellsWfcContributions,
99-
double * rho,
100-
double * gradRho,
101-
const bool isEvaluateGradRho);
102-
#endif
103-
10477
} // namespace dftfe
10578
#endif
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// ---------------------------------------------------------------------
2+
//
3+
// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4+
// authors.
5+
//
6+
// This file is part of the DFT-FE code.
7+
//
8+
// The DFT-FE code is free software; you can use it, redistribute
9+
// it, and/or modify it under the terms of the GNU Lesser General
10+
// Public License as published by the Free Software Foundation; either
11+
// version 2.1 of the License, or (at your option) any later version.
12+
// The full text of the license can be found in the file LICENSE at
13+
// the top level of the DFT-FE distribution.
14+
//
15+
// ---------------------------------------------------------------------
16+
//
17+
18+
#ifndef densityCalculatorDeviceKernels_H_
19+
#define densityCalculatorDeviceKernels_H_
20+
#if defined(DFTFE_WITH_DEVICE)
21+
22+
# include <BLASWrapper.h>
23+
# include <DataTypeOverloads.h>
24+
# include <DeviceAPICalls.h>
25+
# include <DeviceDataTypeOverloads.h>
26+
# include <DeviceTypeConfig.h>
27+
# include <DeviceKernelLauncherConstants.h>
28+
# include <memory>
29+
namespace dftfe
30+
{
31+
template <typename NumberType>
32+
void
33+
computeRhoGradRhoFromInterpolatedValues(
34+
std::shared_ptr<
35+
dftfe::linearAlgebra::BLASWrapper<dftfe::utils::MemorySpace::DEVICE>>
36+
& BLASWrapperPtr,
37+
const std::pair<unsigned int, unsigned int> cellRange,
38+
const std::pair<unsigned int, unsigned int> vecRange,
39+
const unsigned int nQuadsPerCell,
40+
double * partialOccupVec,
41+
NumberType * wfcQuadPointData,
42+
NumberType * gradWfcQuadPointData,
43+
double * rhoCellsWfcContributions,
44+
double * gradRhoCellsWfcContributions,
45+
double * rho,
46+
double * gradRho,
47+
const bool isEvaluateGradRho);
48+
49+
template <typename NumberType>
50+
void
51+
computeRhoResponseFromInterpolatedValues(
52+
std::shared_ptr<
53+
dftfe::linearAlgebra::BLASWrapper<dftfe::utils::MemorySpace::DEVICE>>
54+
& BLASWrapperPtr,
55+
const std::pair<unsigned int, unsigned int> cellRange,
56+
const std::pair<unsigned int, unsigned int> vecRange,
57+
const unsigned int nQuadsPerCell,
58+
double * onesVec,
59+
double * partialOccupVecPrime,
60+
NumberType * wfcQuadPointData,
61+
NumberType * wfcPrimeQuadPointData,
62+
double *rhoResponseHamCellsWfcContributions,
63+
double *rhoResponseFermiEnergyCellsWfcContributions,
64+
double *rhoResponseHam,
65+
double *rhoResponseFermiEnergy);
66+
67+
template <typename NumberType>
68+
void
69+
computeKineticEnergyDensityFromInterpolatedValues(
70+
const dftfe::linearAlgebra::BLASWrapper<dftfe::utils::MemorySpace::DEVICE>
71+
& BLASWrapperPtr,
72+
const std::pair<unsigned int, unsigned int> cellRange,
73+
const std::pair<unsigned int, unsigned int> vecRange,
74+
const unsigned int nQuadsPerCell,
75+
double * partialOccupVec,
76+
double * kcoord,
77+
NumberType * wfcQuadPointData,
78+
NumberType * gradWfcQuadPointData,
79+
double * kineticEnergyCellsWfcContributions,
80+
double * kineticEnergyDensity,
81+
const MPI_Comm &mpiCommDomain);
82+
83+
} // namespace dftfe
84+
#endif
85+
#endif

include/densityFirstOrderResponseCalculator.h

+2-28
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "dftParameters.h"
2424
#include "FEBasisOperations.h"
2525
#include <BLASWrapper.h>
26+
#include "densityCalculatorDeviceKernels.h"
2627

2728

2829
namespace dftfe
@@ -57,15 +58,12 @@ namespace dftfe
5758
template <typename NumberType>
5859
void
5960
computeRhoResponseFromInterpolatedValues(
60-
std::shared_ptr<
61-
dftfe::basis::
62-
FEBasisOperations<NumberType, double, dftfe::utils::MemorySpace::HOST>>
63-
&basisOperationsPtr,
6461
std::shared_ptr<
6562
dftfe::linearAlgebra::BLASWrapper<dftfe::utils::MemorySpace::HOST>>
6663
& BLASWrapperPtr,
6764
const std::pair<unsigned int, unsigned int> cellRange,
6865
const std::pair<unsigned int, unsigned int> vecRange,
66+
const unsigned int nQuadsPerCell,
6967
double * onesVec,
7068
double * partialOccupPrimeVec,
7169
NumberType * wfcQuadPointData,
@@ -75,29 +73,5 @@ namespace dftfe
7573
double *rhoResponseHam,
7674
double *rhoResponseFermiEnergy);
7775

78-
#if defined(DFTFE_WITH_DEVICE)
79-
template <typename NumberType>
80-
void
81-
computeRhoResponseFromInterpolatedValues(
82-
std::shared_ptr<
83-
dftfe::basis::FEBasisOperations<NumberType,
84-
double,
85-
dftfe::utils::MemorySpace::DEVICE>>
86-
&basisOperationsPtr,
87-
std::shared_ptr<
88-
dftfe::linearAlgebra::BLASWrapper<dftfe::utils::MemorySpace::DEVICE>>
89-
& BLASWrapperPtr,
90-
const std::pair<unsigned int, unsigned int> cellRange,
91-
const std::pair<unsigned int, unsigned int> vecRange,
92-
double * onesVec,
93-
double * partialOccupVecPrime,
94-
NumberType * wfcQuadPointData,
95-
NumberType * wfcPrimeQuadPointData,
96-
double *rhoResponseHamCellsWfcContributions,
97-
double *rhoResponseFermiEnergyCellsWfcContributions,
98-
double *rhoResponseHam,
99-
double *rhoResponseFermiEnergy);
100-
#endif
101-
10276
} // namespace dftfe
10377
#endif

0 commit comments

Comments
 (0)