Skip to content

Commit 00ddd93

Browse files
authored
CUDA13 compatibility fix. Closes #693.
gpu_thrust.cuh: removed thrust::[unary|binary]_function which has been removed from CCCL.
2 parents b0c66d2 + 8769083 commit 00ddd93

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

quest/src/gpu/gpu_thrust.cuh

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -175,44 +175,44 @@ auto getEndPtr(FullStateDiagMatr matr) {
175175
*/
176176

177177

178-
struct functor_getAmpConj : public thrust::unary_function<cu_qcomp,cu_qcomp> {
178+
struct functor_getAmpConj {
179179

180180
__host__ __device__ cu_qcomp operator()(cu_qcomp amp) {
181181
return getCompConj(amp);
182182
}
183183
};
184184

185-
struct functor_getAmpNorm : public thrust::unary_function<cu_qcomp,qreal> {
185+
struct functor_getAmpNorm {
186186

187187
__host__ __device__ qreal operator()(cu_qcomp amp) {
188188
return getCompNorm(amp);
189189
}
190190
};
191191

192-
struct functor_getAmpReal : public thrust::unary_function<cu_qcomp,qreal> {
192+
struct functor_getAmpReal {
193193

194194
__host__ __device__ qreal operator()(cu_qcomp amp) {
195195
return getCompReal(amp);
196196
}
197197
};
198198

199199

200-
struct functor_getAmpConjProd : public thrust::binary_function<cu_qcomp,cu_qcomp,cu_qcomp> {
200+
struct functor_getAmpConjProd {
201201

202202
__host__ __device__ cu_qcomp operator()(cu_qcomp braAmp, cu_qcomp ketAmp) {
203203
return getCompConj(braAmp) * ketAmp;
204204
}
205205
};
206206

207-
struct functor_getNormOfAmpDif : public thrust::binary_function<cu_qcomp,cu_qcomp,qreal> {
207+
struct functor_getNormOfAmpDif {
208208

209209
__host__ __device__ qreal operator()(cu_qcomp amp1, cu_qcomp amp2) {
210210
return getCompNorm(amp1 - amp2);
211211
}
212212
};
213213

214214

215-
struct functor_getExpecStateVecZTerm : public thrust::binary_function<qindex,cu_qcomp,qreal> {
215+
struct functor_getExpecStateVecZTerm {
216216

217217
// this functor computes a single term from the sum
218218
// in the expectation value of Z of a statevector
@@ -229,7 +229,7 @@ struct functor_getExpecStateVecZTerm : public thrust::binary_function<qindex,cu_
229229
};
230230

231231

232-
struct functor_getExpecDensMatrZTerm : public thrust::unary_function<qindex,cu_qcomp> {
232+
struct functor_getExpecDensMatrZTerm {
233233

234234
// this functor computes a single term from the sum
235235
// in the expectation value of Z of a density matrix
@@ -252,7 +252,7 @@ struct functor_getExpecDensMatrZTerm : public thrust::unary_function<qindex,cu_q
252252
};
253253

254254

255-
struct functor_getExpecStateVecPauliTerm : public thrust::unary_function<qindex,cu_qcomp> {
255+
struct functor_getExpecStateVecPauliTerm {
256256

257257
// this functor computes a single term from the sum in the
258258
// expectation value of a Pauli str (which necessarily contains
@@ -276,7 +276,7 @@ struct functor_getExpecStateVecPauliTerm : public thrust::unary_function<qindex,
276276
};
277277

278278

279-
struct functor_getExpecDensMatrPauliTerm : public thrust::unary_function<qindex,cu_qcomp> {
279+
struct functor_getExpecDensMatrPauliTerm {
280280

281281
// this functor computes a single term from the sum in the
282282
// expectation value of a Pauli str (which necessarily contains
@@ -304,7 +304,7 @@ struct functor_getExpecDensMatrPauliTerm : public thrust::unary_function<qindex,
304304

305305

306306
template <bool HasPower, bool UseRealPow>
307-
struct functor_getExpecDensMatrDiagMatrTerm : public thrust::unary_function<qindex,cu_qcomp> {
307+
struct functor_getExpecDensMatrDiagMatrTerm {
308308

309309
// this functor computes a single term from the sum in the expectation
310310
// value of a FullStateDiagMatr upon a density matrix
@@ -372,7 +372,7 @@ struct functor_setAmpToPauliStrSumElem {
372372
};
373373

374374

375-
struct functor_mixAmps : public thrust::binary_function<cu_qcomp,cu_qcomp,cu_qcomp> {
375+
struct functor_mixAmps {
376376

377377
// this functor linearly combines the given pair
378378
// of amplitudes, weighted by the fixed qreals,
@@ -389,7 +389,7 @@ struct functor_mixAmps : public thrust::binary_function<cu_qcomp,cu_qcomp,cu_qco
389389

390390

391391
template <bool HasPower, bool UseRealPow, bool Norm>
392-
struct functor_multiplyElemPowerWithAmpOrNorm : public thrust::binary_function<cu_qcomp,cu_qcomp,cu_qcomp> {
392+
struct functor_multiplyElemPowerWithAmpOrNorm {
393393

394394
// this functor multiplies a diagonal matrix element
395395
// raised to a power (templated to optimise away the
@@ -415,7 +415,7 @@ struct functor_multiplyElemPowerWithAmpOrNorm : public thrust::binary_function<c
415415
};
416416

417417

418-
struct functor_getDiagInd : public thrust::unary_function<qindex,qindex> {
418+
struct functor_getDiagInd {
419419

420420
// this functor accepts the index of a statevector
421421
// basis-state and produces the index of a density
@@ -435,7 +435,7 @@ struct functor_getDiagInd : public thrust::unary_function<qindex,qindex> {
435435

436436

437437
template <int NumBits>
438-
struct functor_insertBits : public thrust::unary_function<qindex,qindex> {
438+
struct functor_insertBits {
439439

440440
// this functor inserts bits into a qindex value, and
441441
// is used to enumerate specific basis-state indices
@@ -463,8 +463,7 @@ struct functor_insertBits : public thrust::unary_function<qindex,qindex> {
463463

464464

465465
template <bool Conj>
466-
struct functor_getFidelityTerm : public thrust::unary_function<qindex,cu_qcomp>
467-
{
466+
struct functor_getFidelityTerm {
468467
int rank, numQubits;
469468
qindex logNumAmpsPerNode, numAmpsPerCol;
470469
cu_qcomp *rho, *psi;
@@ -503,7 +502,7 @@ struct functor_getFidelityTerm : public thrust::unary_function<qindex,cu_qcomp>
503502

504503

505504
template <int NumTargets>
506-
struct functor_projectStateVec : public thrust::binary_function<qindex,cu_qcomp,cu_qcomp> {
505+
struct functor_projectStateVec {
507506

508507
// this functor multiplies an amp with zero or a
509508
// renormalisation codfficient, depending on whether
@@ -540,7 +539,7 @@ struct functor_projectStateVec : public thrust::binary_function<qindex,cu_qcomp,
540539

541540

542541
template <int NumTargets>
543-
struct functor_projectDensMatr : public thrust::binary_function<qindex,cu_qcomp,cu_qcomp> {
542+
struct functor_projectDensMatr {
544543

545544
// this functor multiplies an amp with zero or a
546545
// renormalisation coefficient, depending on whether
@@ -585,7 +584,7 @@ struct functor_projectDensMatr : public thrust::binary_function<qindex,cu_qcomp,
585584
};
586585

587586

588-
struct functor_setRandomStateVecAmp : public thrust::unary_function<qindex,cu_qcomp> {
587+
struct functor_setRandomStateVecAmp {
589588

590589
// this functor generates a random, unnormalised
591590
// statevector amplitude which, after normalisation

0 commit comments

Comments
 (0)