Commit 82fc80ca authored by Jason Wu's avatar Jason Wu
Browse files

got rid of unused parameters and definfing global constant

parent 58f84368
Pipeline #92300 failed with stages
in 1 minute and 28 seconds
#ifndef PSRDADA_CPP_EFFELSBERG_EDD_EDDPOLNMERGE_HPP
#define PSRDADA_CPP_EFFELSBERG_EDD_EDDPOLNMERGE_HPP
#define HEAP_SIZE = 4096
#include "psrdada_cpp/dada_write_client.hpp"
#include "psrdada_cpp/raw_bytes.hpp"
#include "psrdada_cpp/common.hpp"
......@@ -12,7 +13,7 @@ namespace edd {
class EDDPolnMerge
{
public:
EDDPolnMerge(std::size_t nsamps_per_heap, std::size_t npol, int nthreads, DadaWriteClient& writer);
EDDPolnMerge(std::size_t npol, int nthreads, DadaWriteClient& writer);
~EDDPolnMerge();
/**
......@@ -37,7 +38,6 @@ public:
bool operator()(RawBytes& block);
private:
std::size_t _nsamps_per_heap;
std::size_t _npol;
int _nthreads;
DadaWriteClient& _writer;
......
#ifndef PSRDADA_CPP_EFFELSBERG_EDD_EDDPOLNMERGE_HPP
#define PSRDADA_CPP_EFFELSBERG_EDD_EDDPOLNMERGE_HPP
#define HEAP_SIZE = 262144
#define BYTES_PER_CHUNK = 32
#include "psrdada_cpp/dada_write_client.hpp"
#include "psrdada_cpp/raw_bytes.hpp"
#include "psrdada_cpp/common.hpp"
......@@ -12,7 +14,7 @@ namespace edd {
class EDDRoach_merge
{
public:
EDDRoach_merge(std::size_t nsamps_per_heap, std::size_t nchunck, int nthreads, DadaWriteClient& writer);
EDDRoach_merge(std::size_t nchunck, int nthreads, DadaWriteClient& writer);
~EDDRoach_merge();
/**
......@@ -37,7 +39,6 @@ public:
bool operator()(RawBytes& block);
private:
std::size_t _nsamps_per_heap;
std::size_t _nchunck;
int _nthreads;
DadaWriteClient& _writer;
......
#ifndef PSRDADA_CPP_EFFELSBERG_EDD_EDDROACH_MERGE_LEAP_HPP
#define PSRDADA_CPP_EFFELSBERG_EDD_EDDROACH_MERGE_LEAP_HPP
#define HEAP_SIZE = 32000
#include "psrdada_cpp/dada_write_client.hpp"
#include "psrdada_cpp/raw_bytes.hpp"
#include "psrdada_cpp/common.hpp"
......@@ -12,7 +13,7 @@ namespace edd {
class EDDRoach_merge_leap
{
public:
EDDRoach_merge_leap(std::size_t nsamps_per_heap, std::size_t nchunck, int nthreads, DadaWriteClient& writer);
EDDRoach_merge_leap(std::size_t nchunck, int nthreads, DadaWriteClient& writer);
~EDDRoach_merge_leap();
/**
......@@ -37,7 +38,6 @@ public:
bool operator()(RawBytes& block);
private:
std::size_t _nsamps_per_heap;
std::size_t _nchunck;
int _nthreads;
DadaWriteClient& _writer;
......
......@@ -19,9 +19,9 @@ uint64_t interleave(uint32_t x, uint32_t y) {
void merge2pol(char const *buf, char *out)
{
uint8_t *qword0 = (uint8_t*)(buf);
uint8_t *qword1 = (uint8_t*)(buf) + _nsamps_per_heap;
uint8_t *qword1 = (uint8_t*)(buf) + HEAP_SIZE;
uint64_t* D = reinterpret_cast<uint64_t*>(out);
for (int i = 0; i < _nsamps_per_heap / sizeof(uint32_t); i++)
for (int i = 0; i < HEAP_SIZE / sizeof(uint32_t); i++)
{
uint32_t* S0 = reinterpret_cast<uint32_t*>(qword0);
uint32_t* S1 = reinterpret_cast<uint32_t*>(qword1);
......@@ -31,9 +31,8 @@ void merge2pol(char const *buf, char *out)
}
}
EDDPolnMerge::EDDPolnMerge(std::size_t nsamps_per_heap, std::size_t npol, int nthreads, DadaWriteClient& writer)
: _nsamps_per_heap(nsamps_per_heap)
, _npol(npol)
EDDPolnMerge::EDDPolnMerge(std::size_t npol, int nthreads, DadaWriteClient& writer)
: _npol(npol)
, _nthreads(nthreads)
, _writer(writer)
{
......@@ -91,7 +90,7 @@ void EDDPolnMerge::init(RawBytes& block)
bool EDDPolnMerge::operator()(RawBytes& block)
{
std: size_t nheap_groups = block.used_bytes() / _npol / _nsamps_per_heap;
std: size_t nheap_groups = block.used_bytes() / _npol / HEAP_SIZE;
/**
if (block.used_bytes() < block.total_bytes())
{
......@@ -110,10 +109,10 @@ std: size_t nheap_groups = block.used_bytes() / _npol / _nsamps_per_heap;
}
#pragma omp parallel for schedule(dynamic, _nthreads) num_threads(_nthreads)
for (std::size_t kk = 0; kk < block.used_bytes() / _nsamps_per_heap / _npol ; ++kk)
for (std::size_t kk = 0; kk < block.used_bytes() / HEAP_SIZE / _npol ; ++kk)
{
char *buffer = block.ptr() + _nsamps_per_heap * _npol * kk;
merge2pol(buffer, oblock.ptr() + kk * _npol * _nsamps_per_heap);
char *buffer = block.ptr() + HEAP_SIZE * _npol * kk;
merge2pol(buffer, oblock.ptr() + kk * _npol * HEAP_SIZE);
}
oblock.used_bytes(block.used_bytes());
_writer.data_stream().release();
......
......@@ -55,9 +55,6 @@ int main(int argc, char** argv)
("nthreads,n", po::value<int>(&nthreads)->default_value(2),
"Value of number of threads")
("nsamps_per_heap,b", po::value<std::size_t>(&nsamps_per_heap)->default_value(4096),
"Value of samples per heap")
("log_level", po::value<std::string>()
->default_value("info")
->notifier([](std::string level)
......@@ -89,7 +86,7 @@ int main(int argc, char** argv)
*/
MultiLog log("edd::EDDPolnMerge");
DadaWriteClient output(output_key, log);
effelsberg::edd::EDDPolnMerge merger(nsamps_per_heap, npol, nthreads, output);
effelsberg::edd::EDDPolnMerge merger(npol, nthreads, output);
DadaInputStream <decltype(merger)> input(input_key, log, merger);
input.start();
/**
......
......@@ -9,16 +9,8 @@ namespace psrdada_cpp {
namespace effelsberg {
namespace edd {
uint64_t interleave(uint32_t x, uint32_t y) {
__m128i xvec = _mm_cvtsi32_si128(x);
__m128i yvec = _mm_cvtsi32_si128(y);
__m128i interleaved = _mm_unpacklo_epi8(yvec, xvec);
return _mm_cvtsi128_si64(interleaved);
}
EDDRoach_merge::EDDRoach_merge(std::size_t nsamps_per_heap, std::size_t nchunck, int nthreads, DadaWriteClient& writer)
: _nsamps_per_heap(nsamps_per_heap)
, _nchunck(nchunck)
EDDRoach_merge::EDDRoach_merge(std::size_t nchunck, int nthreads, DadaWriteClient& writer)
: _nchunck(nchunck)
, _nthreads(nthreads)
, _writer(writer)
{
......@@ -78,8 +70,8 @@ bool EDDRoach_merge::operator()(RawBytes& block)
{
BOOST_LOG_TRIVIAL(info) << "nchucnk " << _nchunck << "\n";
RawBytes& oblock = _writer.data_stream().next();
std::size_t bytes_per_chunk = 32;
std::size_t heap_size = 262144;
std::size_t bytes_per_chunk = BYTES_PER_CHUNK;
std::size_t heap_size = HEAP_SIZE;
std::size_t nbands = _nchunck;
#pragma omp parallel for num_threads(_nthreads)
for (std::size_t xx = 0; xx < block.used_bytes() / _nchunck / heap_size; xx++)
......
......@@ -56,9 +56,6 @@ int main(int argc, char** argv)
("nthreads,n", po::value<int>(&nthreads)->default_value(4),
"Value of number of threads")
("nsamps_per_heap,b", po::value<std::size_t>(&nsamps_per_heap)->default_value(4096),
"Value of samples per heap")
("log_level", po::value<std::string>()
->default_value("info")
->notifier([](std::string level)
......@@ -90,7 +87,7 @@ int main(int argc, char** argv)
*/
MultiLog log("edd::EDDRoach_merge");
DadaWriteClient output(output_key, log);
effelsberg::edd::EDDRoach_merge mod(nsamps_per_heap, nchunck, nthreads, output);
effelsberg::edd::EDDRoach_merge mod(nchunck, nthreads, output);
DadaInputStream <decltype(mod)> input(input_key, log, mod);
input.start();
/**
......
......@@ -16,9 +16,8 @@ uint64_t interleave(uint32_t x, uint32_t y) {
return _mm_cvtsi128_si64(interleaved);
}
EDDRoach_merge_leap::EDDRoach_merge_leap(std::size_t nsamps_per_heap, std::size_t nchunck, int nthreads, DadaWriteClient& writer)
: _nsamps_per_heap(nsamps_per_heap)
, _nchunck(nchunck)
EDDRoach_merge_leap::EDDRoach_merge_leap(std::size_t nchunck, int nthreads, DadaWriteClient& writer)
: _nchunck(nchunck)
, _nthreads(nthreads)
, _writer(writer)
{
......@@ -80,7 +79,7 @@ bool EDDRoach_merge_leap::operator()(RawBytes& block)
BOOST_LOG_TRIVIAL(info) << "nchucnk " << _nchunck << "\n";
RawBytes& oblock = _writer.data_stream().next();
std::size_t bytes_per_chunk = 4;
std::size_t heap_size = 32000 * _nchunck;
std::size_t heap_size = HEAP_SIZE * _nchunck;
std::size_t nbands = _nchunck;
#pragma omp parallel for num_threads(_nthreads)
for (std::size_t xx = 0; xx < block.used_bytes() / heap_size; xx++)
......
......@@ -56,9 +56,6 @@ int main(int argc, char** argv)
("nthreads,n", po::value<int>(&nthreads)->default_value(4),
"Value of number of threads")
("nsamps_per_heap,b", po::value<std::size_t>(&nsamps_per_heap)->default_value(4096),
"Value of samples per heap")
("log_level", po::value<std::string>()
->default_value("info")
->notifier([](std::string level)
......@@ -90,7 +87,7 @@ int main(int argc, char** argv)
*/
MultiLog log("edd::EDDRoach_merge_leap");
DadaWriteClient output(output_key, log);
effelsberg::edd::EDDRoach_merge_leap mod(nsamps_per_heap, nchunck, nthreads, output);
effelsberg::edd::EDDRoach_merge_leap mod(nchunck, nthreads, output);
DadaInputStream <decltype(mod)> input(input_key, log, mod);
input.start();
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment