Skip to content

Commit

Permalink
resolved merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Ewan Barr committed Mar 26, 2014
2 parents e11c825 + d20eab8 commit 94b169e
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 58 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ DEBUG =

# Includes and libraries
INCLUDE = -I$(INCLUDE_DIR) -I$(THRUST_DIR) -I${DEDISP_DIR}/include -I${CUDA_DIR}/include -I./tclap
LIBS = -L$(CUDA_DIR)/lib64 -lcuda -lcudart -L${DEDISP_DIR}/lib -ldedisp -lcufft -lpthread
LIBS = -L$(CUDA_DIR)/lib64 -lcuda -lcudart -L${DEDISP_DIR}/lib -ldedisp -lcufft -lpthread -lnvToolsExt

# compiler flags
# --compiler-options -Wall
NVCC_COMP_FLAGS = -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30
NVCCFLAGS = ${OPTIMISE} ${NVCC_COMP_FLAGS} --machine 64 -Xcompiler ${DEBUG}
CFLAGS = -fPIC ${OPTIMISE} ${DEBUG}
NVCCFLAGS = ${UCFLAGS} ${OPTIMISE} ${NVCC_COMP_FLAGS} --machine 64 -Xcompiler ${DEBUG}
CFLAGS = ${UCFLAGS} -fPIC ${OPTIMISE} ${DEBUG}

OBJECTS = ${OBJ_DIR}/kernels.o
EXE_FILES = ${BIN_DIR}/peasoup #${BIN_DIR}/resampling_test ${BIN_DIR}/harmonic_sum_test
Expand Down
9 changes: 5 additions & 4 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
#cuda setup
CUDA_DIR = /usr/local/cuda-5.0/

#Thrust 1.7.1 or highe
#Thrust 1.7.1 or higher
THRUST_DIR = /mnt/home/ebarr/Soft/thrust/thrust

#dedisp setup
DEDISP_DIR = /mnt/home/ebarr/Soft/dedisp
DEDISP_DIR = /lustre/home/ebarr/Soft/dedisp

GCC = gcc
GXX = g++
AR = ar
NVCC = /usr/local/cuda-5.0/bin/nvcc
SHELL = /bin/csh
NVCC = $(CUDA_DIR)/bin/nvcc
SHELL = /bin/bash
UCFLAGS = -DUSE_NVTX
5 changes: 4 additions & 1 deletion include/transforms/harmonicfolder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <kernels/kernels.h>
#include <kernels/defaults.h>
#include <iostream>
#include <utils/nvtx.hpp>

class HarmonicFolder {
private:
Expand All @@ -24,6 +25,7 @@ class HarmonicFolder {

void fold(DevicePowerSpectrum<float>& fold0)
{
PUSH_NVTX_RANGE("Harmonic summing",2)
for (int ii=0;ii<sums.size();ii++)
{
h_data_ptrs[ii] = sums[ii]->get_data();
Expand All @@ -32,7 +34,8 @@ class HarmonicFolder {
device_harmonic_sum(fold0.get_data(),d_data_ptrs,
fold0.get_nbins(),sums.size(),
max_blocks,max_threads);
}
POP_NVTX_RANGE
}

~HarmonicFolder()
{
Expand Down
24 changes: 24 additions & 0 deletions include/utils/nvtx.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once
#ifdef USE_NVTX
#include "nvToolsExt.h"

static const uint32_t colors[] = { 0x0000ff00, 0x000000ff, 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x00ff0000, 0x00ffffff };
static const int num_colors = sizeof(colors)/sizeof(uint32_t);

#define PUSH_NVTX_RANGE(name,cid) { \
int color_id = cid; \
color_id = color_id%num_colors;\
nvtxEventAttributes_t eventAttrib = {0}; \
eventAttrib.version = NVTX_VERSION; \
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \
eventAttrib.colorType = NVTX_COLOR_ARGB; \
eventAttrib.color = colors[color_id]; \
eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \
eventAttrib.message.ascii = name; \
nvtxRangePushEx(&eventAttrib); \
}
#define POP_NVTX_RANGE nvtxRangePop();
#else
#define PUSH_NVTX_RANGE(name,cid)
#define POP_NVTX_RANGE
#endif
103 changes: 53 additions & 50 deletions src/pipeline_multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,108 +141,109 @@ class Worker {
float padding_mean;
int ii;

PUSH_NVTX_RANGE("DM-Loop",0)
while (true){
//timers["get_trial_dm"].start();
ii = manager.get_dm_trial_idx();
//timers["get_trial_dm"].stop();

if (ii==-1)
break;
break;
trials.get_idx(ii,tim);

if (args.verbose)
std::cout << "Copying DM trial to device (DM: " << tim.get_dm() << ")"<< std::endl;

//timers["copy_to_device"].start();
d_tim.copy_from_host(tim);
//timers["copy_to_device"].stop();

//timers["rednoise"].start()
if (padding){
padding_mean = stats::mean<float>(d_tim.get_data(),trials.get_nsamps());
d_tim.fill(trials.get_nsamps(),d_tim.get_nsamps(),padding_mean);
padding_mean = stats::mean<float>(d_tim.get_data(),trials.get_nsamps());
d_tim.fill(trials.get_nsamps(),d_tim.get_nsamps(),padding_mean);
}

if (args.verbose)
std::cout << "Generating accelration list" << std::endl;
std::cout << "Generating accelration list" << std::endl;
acc_plan.generate_accel_list(tim.get_dm(),acc_list);

if (args.verbose)
std::cout << "Searching "<< acc_list.size()<< " acceleration trials for DM "<< tim.get_dm() << std::endl;
std::cout << "Searching "<< acc_list.size()<< " acceleration trials for DM "<< tim.get_dm() << std::endl;

if (args.verbose)
std::cout << "Executing forward FFT" << std::endl;
std::cout << "Executing forward FFT" << std::endl;
r2cfft.execute(d_tim.get_data(),d_fseries.get_data());

if (args.verbose)
std::cout << "Forming power spectrum" << std::endl;
std::cout << "Forming power spectrum" << std::endl;
former.form(d_fseries,pspec);

if (args.verbose)
std::cout << "Finding running median" << std::endl;
std::cout << "Finding running median" << std::endl;
rednoise.calculate_median(pspec);

if (args.verbose)
std::cout << "Dereddening Fourier series" << std::endl;
std::cout << "Dereddening Fourier series" << std::endl;
rednoise.deredden(d_fseries);

if (args.zapfilename!=""){
if (args.verbose)
std::cout << "Zapping birdies" << std::endl;
bzap->zap(d_fseries);
if (args.verbose)
std::cout << "Zapping birdies" << std::endl;
bzap->zap(d_fseries);
}

if (args.verbose)
std::cout << "Forming interpolated power spectrum" << std::endl;
std::cout << "Forming interpolated power spectrum" << std::endl;
former.form_interpolated(d_fseries,pspec);

if (args.verbose)
std::cout << "Finding statistics" << std::endl;
std::cout << "Finding statistics" << std::endl;
stats::stats<float>(pspec.get_data(),size/2+1,&mean,&rms,&std);

if (args.verbose)
std::cout << "Executing inverse FFT" << std::endl;
std::cout << "Executing inverse FFT" << std::endl;
c2rfft.execute(d_fseries.get_data(),d_tim.get_data());
//timers["rednoise"].stop();


CandidateCollection accel_trial_cands;
for (int jj=0;jj<acc_list.size();jj++){
if (args.verbose)
std::cout << "Resampling to "<< acc_list[jj] << " m/s/s" << std::endl;
resampler.resample(d_tim,d_tim_r,size,acc_list[jj]);
PUSH_NVTX_RANGE("Acceleration-Loop",1)

for (int jj=0;jj<acc_list.size();jj++){
if (args.verbose)
std::cout << "Resampling to "<< acc_list[jj] << " m/s/s" << std::endl;
resampler.resample(d_tim,d_tim_r,size,acc_list[jj]);

if (args.verbose)
std::cout << "Execute forward FFT" << std::endl;
r2cfft.execute(d_tim_r.get_data(),d_fseries.get_data());

if (args.verbose)
std::cout << "Form interpolated power spectrum" << std::endl;
former.form_interpolated(d_fseries,pspec);

if (args.verbose)
std::cout << "Normalise power spectrum" << std::endl;
stats::normalise(pspec.get_data(),mean*size,std*size,size/2+1);

if (args.verbose)
std::cout << "Harmonic summing" << std::endl;
harm_folder.fold(pspec);

if (args.verbose)
std::cout << "Finding peaks" << std::endl;
SpectrumCandidates trial_cands(tim.get_dm(),ii,acc_list[jj]);
cand_finder.find_candidates(pspec,trial_cands);
cand_finder.find_candidates(sums,trial_cands);

if (args.verbose)
std::cout << "Execute forward FFT" << std::endl;
r2cfft.execute(d_tim_r.get_data(),d_fseries.get_data());

if (args.verbose)
std::cout << "Form interpolated power spectrum" << std::endl;
former.form_interpolated(d_fseries,pspec);

if (args.verbose)
std::cout << "Normalise power spectrum" << std::endl;
stats::normalise(pspec.get_data(),mean*size,std*size,size/2+1);

if (args.verbose)
std::cout << "Harmonic summing" << std::endl;
harm_folder.fold(pspec);

if (args.verbose)
std::cout << "Finding peaks" << std::endl;
SpectrumCandidates trial_cands(tim.get_dm(),ii,acc_list[jj]);
cand_finder.find_candidates(pspec,trial_cands);
cand_finder.find_candidates(sums,trial_cands);

if (args.verbose)
std::cout << "Distilling harmonics" << std::endl;
accel_trial_cands.append(harm_finder.distill(trial_cands.cands));
if (args.verbose)
std::cout << "Distilling harmonics" << std::endl;
accel_trial_cands.append(harm_finder.distill(trial_cands.cands));
}
POP_NVTX_RANGE
if (args.verbose)
std::cout << "Distilling accelerations" << std::endl;
std::cout << "Distilling accelerations" << std::endl;
dm_trial_cands.append(acc_still.distill(accel_trial_cands.cands));
}

POP_NVTX_RANGE

if (args.zapfilename!="")
delete bzap;

Expand Down Expand Up @@ -314,7 +315,9 @@ int main(int argc, char **argv)
printf("Starting dedispersion...\n");

timers["dedispersion"].start();
PUSH_NVTX_RANGE("Dedisperse",3)
DispersionTrials<unsigned char> trials = dedisperser.dedisperse();
POP_NVTX_RANGE
timers["dedispersion"].stop();

if (args.progress_bar)
Expand Down

0 comments on commit 94b169e

Please sign in to comment.