Client (Android): run the Whetstone benchmarks using VFP or Neon if available. From Carl.

This commit is contained in:
David Anderson 2013-08-27 21:08:02 -07:00
parent 4430a2cacd
commit 7b2ca9e787
5 changed files with 74 additions and 0 deletions

View File

@ -95,6 +95,16 @@ boinc_client_LDADD = $(LIBBOINC) $(LIBBOINC_CRYPT) $(BOINC_EXTRA_LIBS) $(PTHREAD
boinc_clientdir = $(bindir)
if OS_ARM_LINUX
boinc_client_LDADD += libwhetneon.a libwhetvfp.a
noinst_LIBRARIES = libwhetneon.a libwhetvfp.a
libwhetneon_a_SOURCES = whetstone.cpp whetstone.h
libwhetneon_a_CXXFLAGS = $(boinc_client_CXXFLAGS) -DANDROID_NEON -mfloat-abi=softfp -mfpu=neon
libwhetvfp_a_SOURCES = whetstone.cpp whetstone.h
libwhetvfp_a_CXXFLAGS = $(boinc_client_CXXFLAGS) -DANDROID_VFP -mfloat-abi=softfp -mfpu=vfp
endif
switcher_SOURCES = switcher.cpp
switcher_LDFLAGS = $(AM_LDFLAGS) -L../lib
switcher_LDADD = $(LIBBOINC)

View File

@ -60,6 +60,12 @@
#include "filesys.h"
#include "util.h"
#include "cpu_benchmark.h"
// CMC HERE - header file for whetstone namespaces (neon & vfp)
#ifdef ANDROID
#include "whetstone.h"
#endif
#include "client_msgs.h"
#include "log_flags.h"
#include "client_state.h"
@ -171,7 +177,25 @@ int cpu_benchmarks(BENCHMARK_DESC* bdp) {
bdp->error_str[0] = '\0';
host_info.clear_host_info();
// CMC here
#ifdef ANDROID
// check for vfp or neon process or no special fp process
// namespaces separate the different compilations of the same whetstone.cpp file
if ( strstr(gstate.host_info.p_features, " neon ") != NULL ) {
// have ARM neon FP capabilities
retval = android_neon::whetstone(host_info.p_fpops, fp_time, MIN_CPU_TIME);
}
else if ( strstr(gstate.host_info.p_features, " vfp ") != NULL ) {
// have ARM vfp FP capabilities
retval = android_vfp::whetstone(host_info.p_fpops, fp_time, MIN_CPU_TIME);
}
else { // just run normal test
retval = whetstone(host_info.p_fpops, fp_time, MIN_CPU_TIME);
}
#else
retval = whetstone(host_info.p_fpops, fp_time, MIN_CPU_TIME);
#endif
// CMC end
if (retval) {
bdp->error = true;
sprintf(bdp->error_str, "FP benchmark ran only %f sec; ignoring", fp_time);

View File

@ -34,9 +34,25 @@
#endif
#include "util.h"
// CMC android
#ifdef ANDROID
#include "whetstone.h"
#endif
#include "cpu_benchmark.h"
#ifndef SPDP
#define SPDP double
#endif
#ifdef ANDROID
#ifdef ANDROID_NEON
namespace android_neon {
#else
#ifdef ANDROID_VFP
namespace android_vfp {
#endif
#endif
#endif
// External array; store results here so that optimizing compilers
// don't do away with their computation.
@ -278,3 +294,6 @@ int whetstone(double& flops, double& cpu_time, double min_cpu_time) {
return 0;
}
#if defined(ANDROID_NEON) || defined(ANDROID_VFP)
}
#endif // namespace closure

20
client/whetstone.h Normal file
View File

@ -0,0 +1,20 @@
// CMC here
// separate different compilations of whetstone.cpp which will utilize
// various ARM fp features ie neon, vfp, or "normal"
#ifdef ANDROID
#ifdef ANDROID_NEON
// add CXXFLAGS/CFLAGS for gcc: -DANDROID_NEON -mfloat-abi=softfp -mfpu=neon
#include <arm_neon.h>
#endif // ANDROID_NEON
namespace android_neon {
int whetstone(double& flops, double& cpu_time, double min_cpu_time);
}
namespace android_vfp {
int whetstone(double& flops, double& cpu_time, double min_cpu_time);
}
#endif // ANDROID

View File

@ -779,6 +779,7 @@ dnl In case anyone wants to try building the windows code using mingw!
AM_CONDITIONAL(OS_WIN32_MINGW, [echo $host_os | grep '^mingw' > /dev/null])
dnl or OS2
AM_CONDITIONAL(OS_OS2, [echo $host_os | grep '^os2' > /dev/null])
AM_CONDITIONAL(OS_ARM_LINUX, [echo $host_alias | grep '^arm-linux' > /dev/null])
dnl Whether to build fcgi components
AM_CONDITIONAL(ENABLE_FCGI,[test "${enable_fcgi}" = yes])