Skip to content
Snippets Groups Projects
Commit 47d76134 authored by Giuliano Taffoni's avatar Giuliano Taffoni
Browse files

New Makefile structure and python plots of the results

parent f43f86ed
No related branches found
No related tags found
No related merge requests found
*.o *.o
.DS_Store
sync.sh
phase_correction.c phase_correction.c
w-stacking.c w-stacking.c
w-stackingCfftw w-stackingCfftw
......
CC = gcc-10
CXX = g++-10
MPICC = mpicc
MPIC++ = mpiCC
OPTIMIZE = -O3
#-ffast-math -fopt-info-all-omp -fcf-protection=none -fno-stack-protector -foffload=nvptx-none
GSL_INCL = -I/home/taffoni/sw/include #-I/opt/cluster/openmpi/3.1.3/gnu/8.2.0/include
GSL_LIBS = -L/home/taffoni/sw/lib #-L/opt/cluster/openmpi/3.1.3/gnu/8.2.0/lib -lmpi
FFTW_INCL= -I/home/taffoni/sw/include
FFTW_LIB= -L/home/taffoni/sw/lib -lfftw3_mpi -lfftw3
MPI_LIB =
MPI_INCL=
HDF5_INCL =
HDF5_LIB =
OMP = -fopenmp
NVCC = nvcc
NVFLAGS = -arch=sm_70 -Xcompiler -std=c++11
NVLIB = -L/home/taffoni/sw/Linux_x86_64/21.5/cuda/11.3/lib64/ -lcudart -lcuda
CFLAGS += $(OPTIMIZE)
CFLAGS += -I.
CFLAGS += -I/home/taffoni/sw/Linux_x86_64/21.5/comm_libs/mpi/include
CFLAGS += $(FFTW_INCL) $(GSL_INCL)
CFLAGS += $(FFTW_LIB) -lm
CC = gcc
CXX = g++
MPICC = mpicc
MPIC++ = mpiCC
CFLAGS += -O3 -mcpu=native
CFLAGS += -I.
FFTW_INCL= -I/home/taffoni/sw/include
FFTW_LIB= -L/home/taffoni/sw/lib
LIBS = $(FFTW_LIB) -lfftw3_mpi -lfftw3 -lm
NVCC = nvcc
NVFLAGS = -arch=sm_70 -Xcompiler -mno-float128 -std=c++11
NVLIB = -L/cineca/prod/opt/compilers/cuda/10.1/none/lib64/ -lcudart -lcuda
CFLAGS += -O3 -mtune=native
CC = gcc-10
CXX = g++-10
MPICC = mpicc
MPIC++ = mpiCC
OPTIMIZE =
GSL_INCL =
GSL_LIB =
FFTW_INCL=
FFTW_LIB=
NVCC =
NVFLAGS =
NVLIB =
CFLAGS +=
MPICHLIB =
HDF5INCL =
HDF5LIB =
# comment/uncomment the various options depending hoe you want to build the program # comment/uncomment the various options depending hoe you want to build the program
# Set default values for compiler options if no systype options are given or found
CC = mpiCC
CXX = mpiCC
OPTIMIZE = -std=c++11 -Wall -g -O2
MPICHLIB = -lmpich
SWITCHES =
ifdef SYSTYPE
SYSTYPE := $(SYSTYPE)
include Build/Makefile.$(SYSTYPE)
else
include Build/Makefile.systype
endif
# create MPI code # create MPI code
OPT += -DUSE_MPI OPT += -DUSE_MPI
# use FFTW (it can be switched on ONLY if MPI is active) # use FFTW (it can be switched on ONLY if MPI is active)
ifeq (USE_MPI,$(findstring USE_MPI,$(OPT)))
OPT += -DUSE_FFTW OPT += -DUSE_FFTW
endif
# perform one-side communication (suggested) instead of reduce (only if MPI is active) # perform one-side communication (suggested) instead of reduce (only if MPI is active)
OPT += -DONE_SIDE OPT += -DONE_SIDE
# write the full 3D cube of gridded visibilities and its FFT transform # write the full 3D cube of gridded visibilities and its FFT transform
...@@ -12,23 +34,6 @@ OPT += -DWRITE_IMAGE ...@@ -12,23 +34,6 @@ OPT += -DWRITE_IMAGE
# perform w-stacking phase correction # perform w-stacking phase correction
# OPT += PHASE_ON # OPT += PHASE_ON
CC = gcc
CXX = g++
ifeq (USE_MPI,$(findstring USE_MPI,$(OPT)))
CC = mpicc
CXX = mpiCC
endif
OMP = -fopenmp
#OMP =
CFLAGS += -O3 -mcpu=native
CFLAGS += -I.
LIBS = -L$(FFTW_LIB) -lfftw3_mpi -lfftw3 -lm
NVCC = nvcc
NVFLAGS = -arch=sm_70 -Xcompiler -mno-float128 -std=c++11
NVLIB = -L/cineca/prod/opt/compilers/cuda/10.1/none/lib64/ -lcudart -lcuda
DEPS = w-stacking.h w-stacking-fftw.c w-stacking.cu phase_correction.cu DEPS = w-stacking.h w-stacking-fftw.c w-stacking.cu phase_correction.cu
COBJ = w-stacking.o w-stacking-fftw.o phase_correction.o COBJ = w-stacking.o w-stacking-fftw.o phase_correction.o
...@@ -39,11 +44,16 @@ w-stacking.c: w-stacking.cu ...@@ -39,11 +44,16 @@ w-stacking.c: w-stacking.cu
phase_correction.c: phase_correction.cu phase_correction.c: phase_correction.cu
cp phase_correction.cu phase_correction.c cp phase_correction.cu phase_correction.c
ifeq (USE_MPI,$(findstring USE_MPI,$(OPT)))
%.o: %.c $(DEPS)
$(MPICC) -c -o $@ $< $(CFLAGS) $(OPT)
else
%.o: %.c $(DEPS) %.o: %.c $(DEPS)
$(CC) $(OMP) -c -o $@ $< $(CFLAGS) $(OPT) $(CC) $(OMP) -c -o $@ $< $(CFLAGS) $(OPT)
endif
serial: $(COBJ) serial: $(COBJ)
$(CC) $(OMP) -o w-stackingCfftw_serial $(CFLAGS) $^ -lm $(CC) -o w-stackingCfftw_serial $(CFLAGS) $^ -lm
serial_cuda: serial_cuda:
$(NVCC) $(NVFLAGS) -c w-stacking.cu phase_correction.cu $(NVLIB) $(NVCC) $(NVFLAGS) -c w-stacking.cu phase_correction.cu $(NVLIB)
...@@ -51,15 +61,14 @@ serial_cuda: ...@@ -51,15 +61,14 @@ serial_cuda:
$(CXX) $(CFLAGS) $(OPT) -o w-stackingfftw_serial w-stacking-fftw.o w-stacking.o phase_correction.o $(NVLIB) -lm $(CXX) $(CFLAGS) $(OPT) -o w-stackingfftw_serial w-stacking-fftw.o w-stacking.o phase_correction.o $(NVLIB) -lm
mpi: $(COBJ) mpi: $(COBJ)
$(CC) $(OMP) -o w-stackingCfftw $(CFLAGS) $^ $(LIBS) $(MPICC) -o w-stackingCfftw $^ $(CFLAGS)
mpi_cuda: mpi_cuda:
$(NVCC) $(NVFLAGS) -c w-stacking.cu phase_correction.cu $(NVLIB) $(NVCC) $(NVFLAGS) -c w-stacking.cu phase_correction.cu $(NVLIB)
$(CC) $(CFLAGS) $(OPT) -c w-stacking-fftw.c $(MPICC) $(CFLAGS) $(OPT) -c w-stacking-fftw.c
$(CXX) $(CFLAGS) $(OPT) -o w-stackingfftw w-stacking-fftw.o w-stacking.o phase_correction.o $(NVLIB) $(LIBS) -lm $(MPIC++) $(OPT) -o w-stackingfftw w-stacking-fftw.o w-stacking.o phase_correction.o $(NVLIB) $(CFLAGS)
clean: clean:
rm *.o rm *.o
rm w-stacking.c rm w-stacking.c
rm phase_correction.c rm phase_correction.c
...@@ -10,7 +10,8 @@ nplanes = 1; ...@@ -10,7 +10,8 @@ nplanes = 1;
% id = '4'; % id = '4';
suffix = ''; suffix = '';
id = ''; id = '';
datadir = "/Users/cgheller/Work/Gridding/data/"; d
atadir = "/Users/cgheller/Work/Gridding/data/";
filename1 = strcat(datadir,"fft_real",suffix,id,'.bin'); filename1 = strcat(datadir,"fft_real",suffix,id,'.bin');
filename2 = strcat(datadir,"fft_img",suffix,id,'.bin'); filename2 = strcat(datadir,"fft_img",suffix,id,'.bin');
s = dir(filename1); s = dir(filename1);
...@@ -52,4 +53,3 @@ xlabel('cell'); ...@@ -52,4 +53,3 @@ xlabel('cell');
ylabel('cell'); ylabel('cell');
pngimage = strcat(datadir,'fft-2freq',suffix,id,'.png'); pngimage = strcat(datadir,'fft-2freq',suffix,id,'.png');
saveas(gcf,pngimage); saveas(gcf,pngimage);
#!/usr/bin/python3
import numpy as np
import matplotlib.pyplot as plt
filename1 = "fft_real.bin"
filename2 = "fft_img.bin"
nplanes = 1
with open(filename1, 'rb') as f1:
vreal = np.fromfile(f1, dtype=np.float64)
with open(filename2, 'rb') as f2:
vimg = np.fromfile(f2, dtype=np.float64)
xaxis = int(np.sqrt(vreal.size))
yaxes = xaxis
residual = np.vectorize(complex)(vreal, vimg)
cumul2d = residual.reshape((xaxis,yaxes,nplanes), order='F')
for i in range(nplanes):
gridded = np.squeeze(cumul2d[:,:,i])
ax = plt.subplot()
img = ax.imshow(np.abs(np.fft.fftshift(gridded)), aspect='auto', interpolation='none', origin='lower')
ax.set_xlabel('cell')
ax.set_ylabel('cell')
cbar = plt.colorbar(img)
cbar.set_label('norm(FFT)',size=18)
figname='grid_image_' + str(i) + '.png'
plt.savefig(figname)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment