Merge branch 'sm35_foreach' of github.com:egaburov/ispc into sm35_foreach
This commit is contained in:
40
examples_cuda/options/Makefile_knc
Normal file
40
examples_cuda/options/Makefile_knc
Normal file
@@ -0,0 +1,40 @@
|
||||
PROG=options_mic
|
||||
ISPC_SRC=options.ispc
|
||||
CXX_SRC=options.cpp ../tasksys.cpp
|
||||
|
||||
CXX=icc
|
||||
CXXFLAGS=-O3 -I$(CUDATK)/include -mmic -openmp
|
||||
LD=icc
|
||||
LDFLAGS=-mmic -openmp
|
||||
|
||||
ISPC=ispc
|
||||
ISPCFLAGS=-O3 --math-lib=default --target=generic-16 --c++-include-file=../intrinsics/knc-i1x16.h --opt=fast-math
|
||||
|
||||
.SUFFIXES: .o .cpp
|
||||
|
||||
|
||||
ISPC_OBJ=$(ISPC_SRC:%.ispc=%_ispc.o)
|
||||
ISPC_ZMM=$(ISPC_SRC:%.ispc=%_ispc_zmm.cpp)
|
||||
CXX_OBJ=$(ISPC_ZMM:%_zmm.cpp=%.o)
|
||||
CXX_OBJ+=$(CXX_SRC:%.cpp=%.o)
|
||||
|
||||
all: $(PROG)
|
||||
|
||||
|
||||
$(CXX_OBJ) : $(ISPC_ZMM)
|
||||
|
||||
$(PROG): $(CXX_OBJ)
|
||||
$(LD) -o $@ $(CXX_OBJ) $(LDFLAGS)
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
|
||||
%_ispc_zmm.cpp: %.ispc
|
||||
$(ISPC) $(ISPCFLAGS) --emit-c++ -o `basename $< .ispc`_zmm.cpp -h `basename $< .ispc`_ispc.h $<
|
||||
|
||||
clean:
|
||||
/bin/rm -rf *_ispc_zmm.cpp *.o $(PROG)
|
||||
|
||||
|
||||
|
||||
@@ -60,6 +60,10 @@ static inline double rtc(void)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
#define SINGLE_TASK
|
||||
#endif
|
||||
|
||||
extern void black_scholes_serial(float Sa[], float Xa[], float Ta[],
|
||||
float ra[], float va[],
|
||||
float result[], int count);
|
||||
@@ -107,6 +111,7 @@ int main(int argc, char *argv[]) {
|
||||
// Binomial options pricing model, ispc implementation
|
||||
//
|
||||
double binomial_ispc = 1e30;
|
||||
#ifdef SINGLE_TASK
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
reset_and_start_timer();
|
||||
const double t0 = rtc();
|
||||
@@ -120,6 +125,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
printf("[binomial ispc, 1 thread]:\t[%.3f] million cycles (avg %f)\n",
|
||||
binomial_ispc, sum / nOptions);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Binomial options pricing model, ispc implementation, tasks
|
||||
@@ -166,6 +172,7 @@ int main(int argc, char *argv[]) {
|
||||
// Black-Scholes options pricing model, ispc implementation, 1 thread
|
||||
//
|
||||
double bs_ispc = 1e30;
|
||||
#ifdef SINGLE_TASK
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
reset_and_start_timer();
|
||||
const double t0 = rtc();
|
||||
@@ -179,6 +186,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
printf("[black-scholes ispc, 1 thread]:\t[%.3f] million cycles (avg %f)\n",
|
||||
bs_ispc, sum / nOptions);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Black-Scholes options pricing model, ispc implementation, tasks
|
||||
|
||||
Reference in New Issue
Block a user