How to create makefile CUDA so it executed in CPU to test CPU FLOPs?
I'm trying to count the GPU and CPU FLOPs and I've got the source from here
I renamed it to cudaflops.cu and compiled it with this makefile
################################################################################
#
# Build script for project
#
################################################################################
# Add source files here
EXECUT开发者_运维百科ABLE := benchmark
# Cuda source files (compiled with cudacc)
CUFILES := cudaflops.cu
# C/C++ source files (compiled with gcc / c++)
CCFILES :=
################################################################################
# Rules and targets
include ../../common/common.mk
#########################################
Tt works fine and gives result 367 GFlOPs
But now, I don't know to test this source in CPU, I read this which say that the source could run on CPU.
So how the modified makefile to do it??
Hey so the issue is you need portland group compilers in order to run your code on x86: hxxp://www.prnewswire.com/news-releases/pgi-to-develop-compiler-based-on-nvidia-cuda-c-architecture-for-x86-platforms-103457159.html
Additionally that article says that the compiler is being demonstrated November 13-15, 2010, so I'm not sure when it will be publicly available (probably a beta version floating around). (I.e. No you can't run CUDA natively on x86 YET).
right now the easiest thing to do is write a C/C++ function that does exactly what that benchmark does (it should be VERY easy to port). There are some CUDA examples in their SDK that compare CPU to GPU (look at matrix multiplication I think), so try that first (it should basically do the exact same thing as the benchmark code, except for a 'real world' case) if you're just looking to do GPU/CPU performance.
Even easier: ask NVIDIA forums about your graphics card - they love to tell everyone their GPU vs CPU performance (just say "I have x GPU and i get y GFLOPS-what does everyone else get GPU vs CPU?").
精彩评论