Skip to content

Commit

Permalink
Skip rows with hidden field set
Browse files Browse the repository at this point in the history
Note that this was added for the FeH module in the previous commit.
  • Loading branch information
mjuric committed May 19, 2010
1 parent 35b0098 commit 3428857
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 31 deletions.
7 changes: 5 additions & 2 deletions src/modules/Bond2010_gpu.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace Bond2010
//
#if !__CUDACC__ && !BUILD_FOR_CPU

DECLARE_KERNEL(os_Bond2010_kernel(otable_ks ks, gpu_rng_t rng, cint_t::gpu_t comp, cfloat_t::gpu_t XYZ, cfloat_t::gpu_t vcyl));
DECLARE_KERNEL(os_Bond2010_kernel(otable_ks ks, gpu_rng_t rng, cint_t::gpu_t comp, cint_t::gpu_t hidden, cfloat_t::gpu_t XYZ, cfloat_t::gpu_t vcyl));

#else // #if !__CUDACC__ && !BUILD_FOR_CPU

Expand Down Expand Up @@ -166,10 +166,11 @@ namespace Bond2010
os_Bond2010_kernel(
otable_ks ks, gpu_rng_t rng,
cint_t::gpu_t comp,
cint_t::gpu_t hidden,
cfloat_t::gpu_t XYZ,
cfloat_t::gpu_t vcyl),
os_Bond2010_kernel,
(ks, rng, comp, XYZ, vcyl)
(ks, rng, comp, hidden, XYZ, vcyl)
)
{
using namespace Bond2010;
Expand All @@ -178,6 +179,8 @@ namespace Bond2010
rng.load(threadID());
for(int row=ks.row_begin(); row < ks.row_end(); row++)
{
if(hidden(row)) { continue; }

// fetch prerequisites
const int cmp = comp(row);

Expand Down
3 changes: 2 additions & 1 deletion src/modules/Bond2010_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ size_t os_Bond2010::process(otable &in, size_t begin, size_t end, rng_t &rng)

// fetch prerequisites
cint_t &comp = in.col<int>("comp");
cint_t &hidden= in.col<int>("hidden");
cfloat_t &XYZ = in.col<float>("XYZ");
cfloat_t &vcyl = in.col<float>("vcyl");

Expand All @@ -84,7 +85,7 @@ size_t os_Bond2010::process(otable &in, size_t begin, size_t end, rng_t &rng)
cuxUploadConst("os_Bond2010_par", static_cast<os_Bond2010_data&>(*this)); // for GPU execution
os_Bond2010_par = static_cast<os_Bond2010_data&>(*this); // for CPU execution

CALL_KERNEL(os_Bond2010_kernel, otable_ks(begin, end), rng, comp, XYZ, vcyl);
CALL_KERNEL(os_Bond2010_kernel, otable_ks(begin, end), rng, comp, hidden, XYZ, vcyl);
return nextlink->process(in, begin, end, rng);
}

Expand Down
6 changes: 4 additions & 2 deletions src/modules/GaussianFeH_gpu.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@ KERNEL(
ks, 3*4,
os_GaussianFeH_kernel(
otable_ks ks, bit_map applyToComponents, float mean, float sigma, gpu_rng_t rng,
cint_t::gpu_t comp,
cint_t::gpu_t comp, cint_t::gpu_t hidden,
cfloat_t::gpu_t XYZ,
cfloat_t::gpu_t FeH),
os_GaussianFeH_kernel,
(ks, applyToComponents, mean, sigma, rng, comp, XYZ, FeH)
(ks, applyToComponents, mean, sigma, rng, comp, hidden, XYZ, FeH)
)
{
uint32_t tid = threadID();
rng.load(tid);
for(uint32_t row = ks.row_begin(); row < ks.row_end(); row++)
{
if(hidden(row)) { continue; }

int cmp = comp(row);
if(!applyToComponents.isset(cmp)) { continue; }

Expand Down
5 changes: 3 additions & 2 deletions src/modules/GaussianFeH_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class os_GaussianFeH : public osink
extern "C" opipeline_stage *create_module_gaussianfeh() { return new os_GaussianFeH(); } // Factory; called by opipeline_stage::create()

DECLARE_KERNEL(os_GaussianFeH_kernel(otable_ks ks, bit_map applyToComponents, float mean, float sigma, gpu_rng_t rng,
cint_t::gpu_t comp,
cint_t::gpu_t comp, cint_t::gpu_t hidden,
cfloat_t::gpu_t XYZ,
cfloat_t::gpu_t FeH));

Expand All @@ -62,10 +62,11 @@ size_t os_GaussianFeH::process(otable &in, size_t begin, size_t end, rng_t &rng)

// fetch prerequisites
cint_t &comp = in.col<int>("comp");
cint_t &hidden= in.col<int>("hidden");
cfloat_t &XYZ = in.col<float>("XYZ");
cfloat_t &FeH = in.col<float>("FeH");

CALL_KERNEL(os_GaussianFeH_kernel, otable_ks(begin, end), applyToComponents, mean, sigma, rng, comp, XYZ, FeH);
CALL_KERNEL(os_GaussianFeH_kernel, otable_ks(begin, end), applyToComponents, mean, sigma, rng, comp, hidden, XYZ, FeH);
return nextlink->process(in, begin, end, rng);
}

Expand Down
8 changes: 5 additions & 3 deletions src/modules/fixedFeH_gpu.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@

#if !__CUDACC__ && !BUILD_FOR_CPU

DECLARE_KERNEL(os_fixedFeH_kernel(otable_ks ks, bit_map applyToComponents, float fixedFeH, cint_t::gpu_t comp, cfloat_t::gpu_t FeH));
DECLARE_KERNEL(os_fixedFeH_kernel(otable_ks ks, bit_map applyToComponents, float fixedFeH, cint_t::gpu_t comp, cint_t::gpu_t hidden, cfloat_t::gpu_t FeH));

#else

KERNEL(
ks, 0,
os_fixedFeH_kernel(otable_ks ks, bit_map applyToComponents, float fixedFeH, cint_t::gpu_t comp, cfloat_t::gpu_t FeH),
os_fixedFeH_kernel(otable_ks ks, bit_map applyToComponents, float fixedFeH, cint_t::gpu_t comp, cint_t::gpu_t hidden, cfloat_t::gpu_t FeH),
os_fixedFeH_kernel,
(ks, applyToComponents, fixedFeH, comp, FeH)
(ks, applyToComponents, fixedFeH, comp, hidden, FeH)
)
{
for(uint32_t row = ks.row_begin(); row < ks.row_end(); row++)
{
if(hidden(row)) { continue; }

int cmp = comp(row);
if(!applyToComponents.isset(cmp)) { continue; }

Expand Down
3 changes: 2 additions & 1 deletion src/modules/fixedFeH_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ size_t os_fixedFeH::process(otable &in, size_t begin, size_t end, rng_t &rng)
// - all stars are main sequence
cfloat_t &FeH = in.col<float>("FeH");
cint_t &comp = in.col<int>("comp");
cint_t &hidden = in.col<int>("hidden");

CALL_KERNEL(os_fixedFeH_kernel, otable_ks(begin, end), applyToComponents, fixedFeH, comp, FeH);
CALL_KERNEL(os_fixedFeH_kernel, otable_ks(begin, end), applyToComponents, fixedFeH, comp, hidden, FeH);
return nextlink->process(in, begin, end, rng);
}

Expand Down
8 changes: 5 additions & 3 deletions src/modules/gal2other_gpu.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//
#if !__CUDACC__ && !BUILD_FOR_CPU

DECLARE_KERNEL(os_gal2other_kernel(otable_ks ks, int coordsys, cdouble_t::gpu_t lb0, cdouble_t::gpu_t out));
DECLARE_KERNEL(os_gal2other_kernel(otable_ks ks, int coordsys, cint_t::gpu_t hidden, cdouble_t::gpu_t lb0, cdouble_t::gpu_t out));

#else // #if !__CUDACC__ && !BUILD_FOR_CPU

Expand Down Expand Up @@ -61,15 +61,17 @@

KERNEL(
ks, 0,
os_gal2other_kernel(otable_ks ks, int coordsys, cdouble_t::gpu_t lb0, cdouble_t::gpu_t out),
os_gal2other_kernel(otable_ks ks, int coordsys, cint_t::gpu_t hidden, cdouble_t::gpu_t lb0, cdouble_t::gpu_t out),
os_gal2other_kernel,
(ks, coordsys, lb0, out)
(ks, coordsys, hidden, lb0, out)
)
{
using namespace peyton; // for mathematical constants

for(uint32_t row = ks.row_begin(); row < ks.row_end(); row++)
{
if(hidden(row)) { continue; }

double2 lb, ret;

// convert to radians
Expand Down
3 changes: 2 additions & 1 deletion src/modules/gal2other_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ extern "C" opipeline_stage *create_module_gal2other() { return new os_gal2other(
size_t os_gal2other::process(otable &in, size_t begin, size_t end, rng_t &rng)
{
cdouble_t &lb = in.col<double>("lb");
cint_t &hidden = in.col<int>("hidden");

if(coordsys == EQU)
{
cdouble_t &out = in.col<double>("radec");
CALL_KERNEL(os_gal2other_kernel, otable_ks(begin, end), coordsys, lb, out);
CALL_KERNEL(os_gal2other_kernel, otable_ks(begin, end), coordsys, hidden, lb, out);
}

return nextlink->process(in, begin, end, rng);
Expand Down
8 changes: 5 additions & 3 deletions src/modules/kinTMIII_gpu.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace kinTMIII {
//
#if !__CUDACC__ && !BUILD_FOR_CPU

DECLARE_KERNEL(os_kinTMIII_kernel(otable_ks ks, gpu_rng_t rng, cint_t::gpu_t comp, cfloat_t::gpu_t XYZ, cfloat_t::gpu_t vcyl));
DECLARE_KERNEL(os_kinTMIII_kernel(otable_ks ks, gpu_rng_t rng, cint_t::gpu_t comp, cint_t::gpu_t hidden, cfloat_t::gpu_t XYZ, cfloat_t::gpu_t vcyl));

#else // #if !__CUDACC__ && !BUILD_FOR_CPU

Expand Down Expand Up @@ -172,11 +172,11 @@ namespace kinTMIII
ks, 3*4,
os_kinTMIII_kernel(
otable_ks ks, gpu_rng_t rng,
cint_t::gpu_t comp,
cint_t::gpu_t comp, cint_t::gpu_t hidden,
cfloat_t::gpu_t XYZ,
cfloat_t::gpu_t vcyl),
os_kinTMIII_kernel,
(ks, rng, comp, XYZ, vcyl)
(ks, rng, comp, hidden, XYZ, vcyl)
)
{
using namespace kinTMIII;
Expand Down Expand Up @@ -208,6 +208,8 @@ namespace kinTMIII
uint32_t tid = threadID();
for(int row=ks.row_begin(); row < ks.row_end(); row++)
{
if(hidden(row)) { continue; }

// fetch prerequisites
const int cmp = comp(row);
float X = par.Rg - XYZ(row, 0);
Expand Down
3 changes: 2 additions & 1 deletion src/modules/kinTMIII_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ size_t os_kinTMIII::process(otable &in, size_t begin, size_t end, rng_t &rng)

// fetch prerequisites
cint_t &comp = in.col<int>("comp");
cint_t &hidden = in.col<int>("hidden");
cfloat_t &XYZ = in.col<float>("XYZ");
cfloat_t &vcyl = in.col<float>("vcyl");

Expand All @@ -83,7 +84,7 @@ size_t os_kinTMIII::process(otable &in, size_t begin, size_t end, rng_t &rng)
cuxUploadConst("os_kinTMIII_par", static_cast<os_kinTMIII_data&>(*this)); // for GPU execution
os_kinTMIII_par = static_cast<os_kinTMIII_data&>(*this); // for CPU execution

CALL_KERNEL(os_kinTMIII_kernel, otable_ks(begin, end), rng, comp, XYZ, vcyl);
CALL_KERNEL(os_kinTMIII_kernel, otable_ks(begin, end), rng, comp, hidden, XYZ, vcyl);
return nextlink->process(in, begin, end, rng);
}

Expand Down
2 changes: 2 additions & 0 deletions src/modules/photometricErrors_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ extern "C" opipeline_stage *create_module_modelphotoerrors() { return new os_mod
size_t os_photometricErrors::process(otable &in, size_t begin, size_t end, rng_t &rng)
{
// mix-in gaussian error, with sigma drawn from preloaded splines
cint_t &hidden = in.col<int>("hidden");
FOREACH(columnsToTransform)
{
cfloat_t::host_t magObs = in.col<float>(i->obsBandset);
Expand All @@ -120,6 +121,7 @@ size_t os_photometricErrors::process(otable &in, size_t begin, size_t end, rng_t

for(size_t row=begin; row <= end; row++)
{
if(hidden(row)) { continue; }
float mag = magTrue(row, bandIdx);
magObs(row, bandIdx) = mag + rng.gaussian(i->sigma(mag));
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/photometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct ALIGN(16) os_photometry_data

#if !__CUDACC__ && !BUILD_FOR_CPU

DECLARE_KERNEL(os_photometry_kernel(otable_ks ks, bit_map applyToComponents, gcfloat_t Am, gcint_t flags, gcfloat_t DM, gcfloat_t Mr, int nabsmag, gcfloat_t mags, gcfloat_t FeH, gcint_t comp));
DECLARE_KERNEL(os_photometry_kernel(otable_ks ks, bit_map applyToComponents, gcfloat_t Am, gcint_t flags, gcfloat_t DM, gcfloat_t Mr, int nabsmag, gcfloat_t mags, gcfloat_t FeH, gcint_t comp, gcint_t hidden));

// Textures with "isochrones" (note that we're assuming a
// single-age population here; no actual dependence on age)
Expand Down
6 changes: 4 additions & 2 deletions src/modules/photometry_gpu.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,18 @@ unsigned int __brev(unsigned int a)

KERNEL(
ks, 0,
os_photometry_kernel(otable_ks ks, bit_map applyToComponents, gcfloat_t Am, gcint_t flags, gcfloat_t DM, gcfloat_t Mr, int nabsmag, gcfloat_t mags, gcfloat_t FeH, gcint_t comp),
os_photometry_kernel(otable_ks ks, bit_map applyToComponents, gcfloat_t Am, gcint_t flags, gcfloat_t DM, gcfloat_t Mr, int nabsmag, gcfloat_t mags, gcfloat_t FeH, gcint_t comp, gcint_t hidden),
os_photometry_kernel,
(ks, applyToComponents, Am, flags, DM, Mr, nabsmag, mags, FeH, comp)
(ks, applyToComponents, Am, flags, DM, Mr, nabsmag, mags, FeH, comp, hidden)
)
{
os_photometry_data &lt = os_photometry_params;
float *c = ks.sharedMemory<float>();

for(uint32_t row = ks.row_begin(); row < ks.row_end(); row++)
{
if(hidden(row)) { continue; }

// should we process this star (based on the galactic model component it belongs to)?
int cmp = comp(row);
if(!applyToComponents.isset(cmp)) { continue; }
Expand Down
3 changes: 2 additions & 1 deletion src/modules/photometry_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ extern os_photometry_data os_photometry_params;
size_t os_photometry::process(otable &in, size_t begin, size_t end, rng_t &rng)
{
cint_t &comp = in.col<int>("comp");
cint_t &hidden = in.col<int>("hidden");
cint_t &flags = in.col<int>(photoFlagsName);
cfloat_t &DM = in.col<float>("DM");
cfloat_t &mags = in.col<float>(bandset2);
Expand All @@ -387,7 +388,7 @@ size_t os_photometry::process(otable &in, size_t begin, size_t end, rng_t &rng)
cuxUploadConst("os_photometry_params", static_cast<os_photometry_data&>(*this)); // for GPU execution
os_photometry_params = static_cast<os_photometry_data&>(*this); // for CPU execution

CALL_KERNEL(os_photometry_kernel, otable_ks(begin, end, -1, sizeof(float)*ncolors), applyToComponents, Am, flags, DM, Mr, Mr.width(), mags, FeH, comp);
CALL_KERNEL(os_photometry_kernel, otable_ks(begin, end, -1, sizeof(float)*ncolors), applyToComponents, Am, flags, DM, Mr, Mr.width(), mags, FeH, comp, hidden);
}

return nextlink->process(in, begin, end, rng);
Expand Down
8 changes: 5 additions & 3 deletions src/modules/unresolvedMultiples_gpu.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace multiplesAlgorithms

#if !__CUDACC__ && !BUILD_FOR_CPU

DECLARE_KERNEL(os_unresolvedMultiples_kernel(otable_ks ks, bit_map applyToComponents, gpu_rng_t rng, int nabsmag, cfloat_t::gpu_t M, cfloat_t::gpu_t Msys, cint_t::gpu_t ncomp, cint_t::gpu_t comp, multiplesAlgorithms::algo algo));
DECLARE_KERNEL(os_unresolvedMultiples_kernel(otable_ks ks, bit_map applyToComponents, gpu_rng_t rng, int nabsmag, cfloat_t::gpu_t M, cfloat_t::gpu_t Msys, cint_t::gpu_t ncomp, cint_t::gpu_t comp, cint_t::gpu_t hidden, multiplesAlgorithms::algo algo));

#else

Expand Down Expand Up @@ -79,9 +79,9 @@ namespace multiplesAlgorithms

KERNEL(
ks, 3*4,
os_unresolvedMultiples_kernel(otable_ks ks, bit_map applyToComponents, gpu_rng_t rng, int nabsmag, cfloat_t::gpu_t M, cfloat_t::gpu_t Msys, cint_t::gpu_t ncomp, cint_t::gpu_t comp, multiplesAlgorithms::algo algo),
os_unresolvedMultiples_kernel(otable_ks ks, bit_map applyToComponents, gpu_rng_t rng, int nabsmag, cfloat_t::gpu_t M, cfloat_t::gpu_t Msys, cint_t::gpu_t ncomp, cint_t::gpu_t comp, cint_t::gpu_t hidden, multiplesAlgorithms::algo algo),
os_unresolvedMultiples_kernel,
(ks, applyToComponents, rng, nabsmag, M, Msys, ncomp, comp, algo)
(ks, applyToComponents, rng, nabsmag, M, Msys, ncomp, comp, hidden, algo)
)
{
/*
Expand All @@ -92,6 +92,8 @@ namespace multiplesAlgorithms
rng.load(threadID());
for(uint32_t row = ks.row_begin(); row < ks.row_end(); row++)
{
if(hidden(row)) { continue; }

int cmp = comp(row);
if(!applyToComponents.isset(cmp)) { continue; }

Expand Down
3 changes: 2 additions & 1 deletion src/modules/unresolvedMultiples_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ size_t os_unresolvedMultiples::process(otable &in, size_t begin, size_t end, rng
// - galactocentric XYZ coordinates exist in input
// - all stars are main sequence
cint_t &comp = in.col<int>("comp");
cint_t &hidden = in.col<int>("hidden");
cfloat_t &M = in.col<float>("absmag");
cfloat_t &Msys = in.col<float>(absmagSys);
cint_t &ncomp = in.col<int>(absmagSys+"Ncomp");
Expand All @@ -99,7 +100,7 @@ size_t os_unresolvedMultiples::process(otable &in, size_t begin, size_t end, rng
t2(::cumLF, cumLF),
t3(::invCumLF, invCumLF);

CALL_KERNEL(os_unresolvedMultiples_kernel, otable_ks(begin, end), applyToComponents, rng, Msys.width(), M, Msys, ncomp, comp, algo);
CALL_KERNEL(os_unresolvedMultiples_kernel, otable_ks(begin, end), applyToComponents, rng, Msys.width(), M, Msys, ncomp, comp, hidden, algo);
}

return nextlink->process(in, begin, end, rng);
Expand Down
10 changes: 7 additions & 3 deletions src/modules/vel2pm_gpu.cu.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ struct os_vel2pm_data
cdouble_t::gpu_t lb0,
cfloat_t::gpu_t XYZ,
cfloat_t::gpu_t vcyl,
cfloat_t::gpu_t pmlb
cfloat_t::gpu_t pmlb,
cint_t::gpu_t hidden
)
);

Expand Down Expand Up @@ -256,14 +257,17 @@ struct os_vel2pm_data
cdouble_t::gpu_t lb0,
cfloat_t::gpu_t XYZ,
cfloat_t::gpu_t vcyl,
cfloat_t::gpu_t pmout),
cfloat_t::gpu_t pmout,
cint_t::gpu_t hidden),
os_vel2pm_kernel,
(ks, par, rng, lb0, XYZ, vcyl, pmout)
(ks, par, rng, lb0, XYZ, vcyl, pmout, hidden)
)
{

for(uint32_t row=ks.row_begin(); row < ks.row_end(); row++)
{
if(hidden(row)) { continue; }

// fetch prerequisites
// NOTE: Single precision should be sufficient here for (l,b)
float l = radf(lb0(row, 0));
Expand Down
3 changes: 2 additions & 1 deletion src/modules/vel2pm_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ size_t os_vel2pm::process(otable &in, size_t begin, size_t end, rng_t &rng)
cfloat_t &XYZ = in.col<float>("XYZ");
cfloat_t &vcyl = in.col<float>("vcyl");
cfloat_t &pmlb = in.col<float>(output_col_name);
cint_t &hidden = in.col<int>("hidden");

CALL_KERNEL(os_vel2pm_kernel, otable_ks(begin, end), *this, rng, lb0, XYZ, vcyl,pmlb);
CALL_KERNEL(os_vel2pm_kernel, otable_ks(begin, end), *this, rng, lb0, XYZ, vcyl, pmlb, hidden);
return nextlink->process(in, begin, end, rng);
}

Expand Down

0 comments on commit 3428857

Please sign in to comment.