Page MenuHomec4science

Makefile.intel
No OneTemporary

File Metadata

Created
Tue, Jul 30, 18:25

Makefile.intel

PROGRAM_NAME := GradientBenchmark
#CXX=g++ -lm -ffast-math -ftree-loop-vectorize
CXX=icpc
all: $(PROGRAM_NAME)
program_CXX_SRCS := gradient.cpp gradient_avx.cpp setup.cpp main.cpp
$(warning obj files are $(program_CXX_SRCS))
#program_CXX_SRCS := $(wildcard *.cpp)
#program_CXX_SRCS += $(wildcard ../../*.cpp) #Find C++ source files from additonal directories
program_CXX_OBJS := ${program_CXX_SRCS:.cpp=.o}
$(warning obj files are $(program_CXX_OBJS))
#
program_INCLUDE_DIRS := . /usr/local/cuda/include/ #C++ Include directories
program_INCLUDE_DIRS += /users/fgilles/Projects/Libs/cfitsio/include
program_INCLUDE_DIRS += /users/fgilles/bin/iaca-lin32/include
program_INCLUDE_DIRS += /users/fgilles/Projects/lenstool-6.8.1/include
program_INCLUDE_DIRS += /users/fgilles/Projects/Libs/gsl-2.2/include
program_CU_INCLUDE_DIRS := /home/users/amclaugh/CUB/cub-1.3.2/ #CUDA Include directories
#
program_INCLUDE_LIBS := /usr/lib64/ #Include libraries
program_INCLUDE_LIBS += /users/fgilles/Projects/Libs/cfitsio/lib #Include libraries
program_INCLUDE_LIBS += /users/fgilles/Projects/lenstool-6.8.1/src
#
# Compiler flags
CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir))
CPPFLAGS += $(foreach includelib,$(program_INCLUDE_LIBS),-L$(includelib) -lcfitsio)
#CXXFLAGS += -march=core-avx2 -g -O3 -std=c++0x -Wall -pedantic
CPPFLAGS += -qopenmp -xMIC-AVX512 -g -O3 -std=c++0x -Wall -pedantic
#CPPFLAGS += -qopenmp -xHost -fma -g -O3 -std=c++0x -Wall -pedantic
#CXXFLAGS += -g -O3 -std=c++0x -Wall
#
OBJECTS = $(program_CXX_OBJS)
#
#$(warning obj files are $(OBJECTS))
#
# This is pretty ugly...details below
# The program depends on both C++ and CUDA Objects, but storing CUDA objects as .o files results in circular dependency
# warnings from Make. However, nvcc requires that object files for linking end in the .o extension, else it will throw
# an error saying that it doesn't know how to handle the file. Using a non .o rule for Make and then renaming the file
# to have the .o extension for nvcc won't suffice because the program will depend on the non .o file but the files in
# the directory after compilation will have a .o suffix. Thus, when one goes to recompile the code all files will be
# recompiled instead of just the ones that have been updated.
#
# The solution below solves these issues by silently converting the non .o suffix needed by make to the .o suffix
# required by nvcc, calling nvcc, and then converting back to the non .o suffix for future, dependency-based
# compilation.
#
%.o: %.cpp
$(CXX) $(CPPFLAGS) -c $<
#
$(PROGRAM_NAME): $(program_CXX_OBJS)
$(CXX) $(CPPFLAGS) -o $@ $(OBJECTS) -llenstool
#
#
.PHONY: all clean distclean
#
clean:
@- $(RM) $(PROGRAM_NAME) $(OBJECTS) *~ *.o *.optrpt
#
distclean: clean

Event Timeline