Skip to content

Commit

Permalink
Put the IntList into a header file.
Browse files Browse the repository at this point in the history
  • Loading branch information
hummingtree committed Dec 11, 2024
1 parent 52bbc43 commit e6ee340
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 46 deletions.
10 changes: 10 additions & 0 deletions include/int_list.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

namespace quda {

/**
@brief This is a dummy struct that wraps around a list of integers
*/
template <int... Ints> struct IntList { };

}
4 changes: 1 addition & 3 deletions lib/block_orthogonalize.in.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "multigrid.h"
#include <int_list.hpp>

namespace quda
{

template <int...> struct IntList {
};

template <int fineColor, int coarseColor, int... N>
void BlockOrthogonalize2(ColorSpinorField &V, const std::vector<ColorSpinorField> &B, const int *fine_to_coarse,
const int *coarse_to_fine, const int *geo_bs, int spin_bs, int n_block_ortho, bool two_pass,
Expand Down
4 changes: 1 addition & 3 deletions lib/block_transpose.in.cu
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <tunable_nd.h>
#include <reference_wrapper_helper.h>
#include <kernels/block_transpose.cuh>
#include <int_list.hpp>

/**
@file BlockTranspose does the transpose between the two different orders of batched colorspinor fields:
Expand Down Expand Up @@ -111,9 +112,6 @@ namespace quda

} // namespace impl

template <int...> struct IntList {
};

template <class v_t, class b_t, typename vFloat, typename bFloat, int nSpin, int nColor, int nVec, int... N>
void launch_span_nVec(v_t &V, cvector_ref<b_t> &B, bool from_to_non_rel, IntList<nVec, N...>)
{
Expand Down
4 changes: 1 addition & 3 deletions lib/coarse_op.in.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "multigrid.h"
#include <int_list.hpp>

namespace quda
{

template <int...> struct IntList {
};

template <int fineColor, int coarseColor, int... N>
void CoarseOp2(GaugeField &Y, GaugeField &X, const Transfer &T, const GaugeField &gauge, const CloverField *clover,
double kappa, double mass, double mu, double mu_factor, QudaDiracType dirac, QudaMatPCType matpc,
Expand Down
4 changes: 1 addition & 3 deletions lib/coarse_op_preconditioned.in.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "multigrid.h"
#include <int_list.hpp>

namespace quda
{

template <int...> struct IntList {
};

template <int Nc, int... N>
void calculateYhat(GaugeField &Yhat, GaugeField &Xinv, const GaugeField &Y, const GaugeField &X, bool use_mma,
IntList<Nc, N...>)
Expand Down
4 changes: 1 addition & 3 deletions lib/coarsecoarse_op.in.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "multigrid.h"
#include <int_list.hpp>

namespace quda
{

template <int...> struct IntList {
};

template <int fineColor, int coarseColor, int... N>
void CoarseCoarseOp2(GaugeField &Y, GaugeField &X, const Transfer &T, const GaugeField &gauge,
const GaugeField &clover, const GaugeField &cloverInv, double kappa, double mass, double mu,
Expand Down
3 changes: 1 addition & 2 deletions lib/color_spinor_pack.in.cu
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <kernels/color_spinor_pack.cuh>
#include <instantiate.h>
#include <multigrid.h>
#include <int_list.hpp>

/**
@file color_spinor_pack.cu
Expand Down Expand Up @@ -153,8 +154,6 @@ namespace quda {
long long bytes() const { return work_items * 2 * a.Nspin() * a.Ncolor() * (a.Precision() + a.GhostPrecision()); }
};

template <int...> struct IntList { };

template <typename Float, typename ghostFloat, int Ns, bool native, int fineColor, int coarseColor, int...N>
bool genericPackGhostC(void **ghost, const ColorSpinorField &a, QudaParity parity, int nFace, int dagger,
MemoryLocation *destination, int shmem, cvector_ref<const ColorSpinorField> &v,
Expand Down
3 changes: 1 addition & 2 deletions lib/color_spinor_util.in.cu
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <index_helper.cuh>
#include <blas_quda.h>
#include <instantiate.h>
#include <int_list.hpp>

namespace quda {

Expand Down Expand Up @@ -127,8 +128,6 @@ namespace quda {
else errorQuda("Unsupported source type %d", sourceType);
}

template <int...> struct IntList { };

template <typename Float, int nSpin, QudaFieldOrder order, typename pack_t, int nColor, int...N>
void genericSource(const pack_t &pack, IntList<nColor, N...>)
{
Expand Down
4 changes: 1 addition & 3 deletions lib/copy_color_spinor_mg.in.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <tunable_nd.h>
#include <kernels/copy_color_spinor_mg.cuh>
#include <multigrid.h>
#include <int_list.hpp>

namespace quda {

Expand Down Expand Up @@ -164,9 +165,6 @@ namespace quda {

}

template <int...> struct IntList {
};

template <int fineColor, typename dst_t, typename src_t, typename param_t, int coarseColor, int... N>
bool instantiateColor(const ColorSpinorField &field, const param_t &param, IntList<coarseColor, N...>)
{
Expand Down
4 changes: 1 addition & 3 deletions lib/copy_gauge.in.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gauge_field.h>
#include <multigrid.h>
#include <int_list.hpp>

namespace quda {

Expand All @@ -19,9 +20,6 @@ namespace quda {
void copyGenericGaugeMG(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In,
void **ghostOut, void **ghostIn, int type);

template <int...> struct IntList {
};

template <int Nc, int... N>
void copyGenericGaugeMG(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In,
void **ghostOut, void **ghostIn, int type, IntList<Nc, N...>)
Expand Down
1 change: 0 additions & 1 deletion lib/dslash_coarse_mma.in.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ namespace quda
if (clover) { strcat(aux, ",clover"); }

setRHSstring(aux, out[0].Nvec_actual());
strcat(aux, rhs_str);
#ifdef USE_TENSOR_MEMORY_ACCELERATOR
strcat(aux, ",use_tma");
#endif
Expand Down
4 changes: 1 addition & 3 deletions lib/dslash_mdw_fused.in.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <worker.h>
#include <domain_wall_helper.h>
#include <fast_intdiv.h>
#include <int_list.hpp>

// Tensor core functions for Mobius DWF
namespace quda
Expand All @@ -21,9 +22,6 @@ namespace quda
const Complex *b_5, const Complex *c_5, bool dagger, int parity, int shift[4],
int halo_shift[4], MdwfFusedDslashType type);

template <int...> struct IntList {
};

template <int Ls, int... N>
void apply_fused_dslash_list(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U,
ColorSpinorField &y, const ColorSpinorField &x, double m_f, double m_5,
Expand Down
3 changes: 1 addition & 2 deletions lib/extract_gauge_ghost.in.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <gauge_field_order.h>
#include <extract_gauge_ghost_helper.cuh>
#include "multigrid.h"
#include <int_list.hpp>

namespace quda {

Expand Down Expand Up @@ -120,8 +121,6 @@ namespace quda {
template <int nColor>
void extractGaugeGhostMG(const GaugeField &u, void **ghost, bool extract, int offset);

template <int...> struct IntList { };

template <int nColor, int...N>
void extractGaugeGhostMG(const GaugeField &u, void **ghost, bool extract, int offset, IntList<nColor, N...>)
{
Expand Down
3 changes: 1 addition & 2 deletions lib/gauge_noise.in.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <instantiate.h>
#include <tunable_nd.h>
#include <kernels/gauge_noise.cuh>
#include <int_list.hpp>

namespace quda {

Expand Down Expand Up @@ -46,8 +47,6 @@ namespace quda {
void postTune() { rng.restore(); }
};

template <int...> struct IntList { };

template <typename real, int nColor, int...N>
void gaugeNoise(GaugeField &U, RNG &rng, QudaNoiseType type, IntList<nColor, N...>)
{
Expand Down
3 changes: 1 addition & 2 deletions lib/gauge_norm.in.cu
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <gauge_field_order.h>
#include <instantiate.h>
#include <memory>
#include <int_list.hpp>

namespace quda {

Expand Down Expand Up @@ -50,8 +51,6 @@ namespace quda {
return norm_;
}

template <int...> struct IntList { };

template <typename T, bool fixed, int nColor, int...N>
double norm(const GaugeField &u, int d, norm_type_ type, IntList<nColor, N...>)
{
Expand Down
4 changes: 1 addition & 3 deletions lib/multigrid.in.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
#include <color_spinor_field.h>
#include <array>
#include <algorithm>
#include <int_list.hpp>

namespace quda {

template <int... Ints> struct IntList {
};

template <int... Values>
auto sort_values() {
std::array<int, sizeof...(Values)> arr = {Values...};
Expand Down
4 changes: 1 addition & 3 deletions lib/spinor_dilute.in.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <kernels/spinor_dilute.cuh>
#include <tunable_nd.h>
#include <instantiate.h>
#include <int_list.hpp>

namespace quda
{
Expand Down Expand Up @@ -79,9 +80,6 @@ namespace quda
long long bytes() const { return v.size() * v[0].Bytes() + src.Bytes(); }
};

template <int...> struct IntList {
};

template <typename real, int Ns, int Nc, int... N>
void spinorDilute(const ColorSpinorField &src, std::vector<ColorSpinorField> &v, QudaDilutionType type,
const lat_dim_t &local_block, IntList<Nc, N...>)
Expand Down
3 changes: 1 addition & 2 deletions lib/spinor_noise.in.cu
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <tunable_nd.h>
#include <kernels/spinor_noise.cuh>
#include <instantiate.h>
#include <int_list.hpp>

namespace quda {

Expand Down Expand Up @@ -42,8 +43,6 @@ namespace quda {
void postTune(){ rng.restore(); }
};

template <int...> struct IntList { };

template <typename real, int Ns, int Nc, int...N>
void spinorNoise(ColorSpinorField &src, RNG& randstates, QudaNoiseType type, IntList<Nc, N...>)
{
Expand Down
4 changes: 1 addition & 3 deletions lib/staggered_coarse_op.in.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#include "multigrid.h"
#include <int_list.hpp>

namespace quda
{

template <int...> struct IntList {
};

template <int fineColor, int coarseColor, int... N>
void StaggeredCoarseOp2(GaugeField &Y, GaugeField &X, const Transfer &T, const GaugeField &gauge,
const GaugeField &longGauge, const GaugeField &XinvKD, double mass, bool allow_truncation,
Expand Down

0 comments on commit e6ee340

Please sign in to comment.