@@ -25,125 +25,73 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*****************************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
#undef AMAX | |||
#ifdef COMPLEX | |||
#ifdef DOUBLE | |||
#define AMAX BLASFUNC(dzamax) | |||
#define AMAX BLASFUNC(dzamax) | |||
#else | |||
#define AMAX BLASFUNC(scamax) | |||
#define AMAX BLASFUNC(scamax) | |||
#endif | |||
#else | |||
#ifdef DOUBLE | |||
#define AMAX BLASFUNC(damax) | |||
#define AMAX BLASFUNC(damax) | |||
#else | |||
#define AMAX BLASFUNC(samax) | |||
#define AMAX BLASFUNC(samax) | |||
#endif | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
int main(int argc, char *argv[]){ | |||
int main(int argc, char *argv[]) | |||
{ | |||
FLOAT *x; | |||
blasint m, i; | |||
blasint inc_x=1; | |||
blasint inc_x = 1; | |||
int loops = 1; | |||
int l; | |||
char *p; | |||
int from = 1; | |||
int to = 200; | |||
int step = 1; | |||
int from = 1; | |||
int to = 200; | |||
int step = 1; | |||
struct timeval start, stop; | |||
double time1,timeg; | |||
double time1, timeg; | |||
argc--;argv++; | |||
argc--; | |||
argv++; | |||
if (argc > 0) { from = atol(*argv); argc--; argv++;} | |||
if (argc > 0) { to = MAX(atol(*argv), from); argc--; argv++;} | |||
if (argc > 0) { step = atol(*argv); argc--; argv++;} | |||
if (argc > 0) | |||
{ | |||
from = atol(*argv); | |||
argc--; | |||
argv++; | |||
} | |||
if (argc > 0) | |||
{ | |||
to = MAX(atol(*argv), from); | |||
argc--; | |||
argv++; | |||
} | |||
if (argc > 0) | |||
{ | |||
step = atol(*argv); | |||
argc--; | |||
argv++; | |||
} | |||
if ((p = getenv("OPENBLAS_LOOPS"))) loops = atoi(p); | |||
if ((p = getenv("OPENBLAS_INCX"))) inc_x = atoi(p); | |||
if ((p = getenv("OPENBLAS_LOOPS"))) | |||
loops = atoi(p); | |||
if ((p = getenv("OPENBLAS_INCX"))) | |||
inc_x = atoi(p); | |||
fprintf(stderr, "From : %3d To : %3d Step = %3d Inc_x = %d Loops = %d\n", from, to, step,inc_x,loops); | |||
fprintf(stderr, "From : %3d To : %3d Step = %3d Inc_x = %d Loops = %d\n", from, to, step, inc_x, loops); | |||
if (( x = (FLOAT *)malloc(sizeof(FLOAT) * to * abs(inc_x) * COMPSIZE)) == NULL){ | |||
fprintf(stderr,"Out of Memory!!\n");exit(1); | |||
if ((x = (FLOAT *)malloc(sizeof(FLOAT) * to * abs(inc_x) * COMPSIZE)) == NULL) | |||
{ | |||
fprintf(stderr, "Out of Memory!!\n"); | |||
exit(1); | |||
} | |||
#ifdef __linux | |||
@@ -152,37 +100,31 @@ int main(int argc, char *argv[]){ | |||
fprintf(stderr, " SIZE Flops\n"); | |||
for(m = from; m <= to; m += step) | |||
for (m = from; m <= to; m += step) | |||
{ | |||
timeg=0; | |||
fprintf(stderr, " %6d : ", (int)m); | |||
timeg = 0; | |||
fprintf(stderr, " %6d : ", (int)m); | |||
for (l = 0; l < loops; l++) | |||
{ | |||
for (l=0; l<loops; l++) | |||
{ | |||
for(i = 0; i < m * COMPSIZE * abs(inc_x); i++){ | |||
x[i] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5; | |||
} | |||
gettimeofday( &start, (struct timezone *)0); | |||
AMAX (&m, x, &inc_x); | |||
gettimeofday( &stop, (struct timezone *)0); | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6; | |||
timeg += time1; | |||
for (i = 0; i < m * COMPSIZE * abs(inc_x); i++) | |||
{ | |||
x[i] = ((FLOAT)rand() / (FLOAT)RAND_MAX) - 0.5; | |||
} | |||
begin(); | |||
AMAX(&m, x, &inc_x); | |||
end(); | |||
timeg += getsec(); | |||
} | |||
timeg /= loops; | |||
fprintf(stderr, | |||
" %10.2f MFlops %10.6f sec\n", | |||
COMPSIZE * sizeof(FLOAT) * 1. * (double)m / timeg * 1.e-6, timeg); | |||
" %10.2f MFlops %10.6f sec\n", | |||
COMPSIZE * sizeof(FLOAT) * 1. * (double)m / timeg * 1.e-6, timeg); | |||
} | |||
return 0; | |||
@@ -25,124 +25,74 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*****************************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
#undef AMIN | |||
#ifdef COMPLEX | |||
#ifdef DOUBLE | |||
#define AMIN BLASFUNC(dzamin) | |||
#define AMIN BLASFUNC(dzamin) | |||
#else | |||
#define AMIN BLASFUNC(scamin) | |||
#define AMIN BLASFUNC(scamin) | |||
#endif | |||
#else | |||
#ifdef DOUBLE | |||
#define AMIN BLASFUNC(damin) | |||
#define AMIN BLASFUNC(damin) | |||
#else | |||
#define AMIN BLASFUNC(samin) | |||
#endif | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#define AMIN BLASFUNC(samin) | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
int main(int argc, char *argv[]){ | |||
int main(int argc, char *argv[]) | |||
{ | |||
FLOAT *x; | |||
blasint m, i; | |||
blasint inc_x=1; | |||
blasint inc_x = 1; | |||
int loops = 1; | |||
int l; | |||
char *p; | |||
int from = 1; | |||
int to = 200; | |||
int step = 1; | |||
int from = 1; | |||
int to = 200; | |||
int step = 1; | |||
struct timeval start, stop; | |||
double time1,timeg; | |||
double time1, timeg; | |||
argc--;argv++; | |||
argc--; | |||
argv++; | |||
if (argc > 0) { from = atol(*argv); argc--; argv++;} | |||
if (argc > 0) { to = MAX(atol(*argv), from); argc--; argv++;} | |||
if (argc > 0) { step = atol(*argv); argc--; argv++;} | |||
if (argc > 0) | |||
{ | |||
from = atol(*argv); | |||
argc--; | |||
argv++; | |||
} | |||
if (argc > 0) | |||
{ | |||
to = MAX(atol(*argv), from); | |||
argc--; | |||
argv++; | |||
} | |||
if (argc > 0) | |||
{ | |||
step = atol(*argv); | |||
argc--; | |||
argv++; | |||
} | |||
if ((p = getenv("OPENBLAS_LOOPS"))) loops = atoi(p); | |||
if ((p = getenv("OPENBLAS_INCX"))) inc_x = atoi(p); | |||
if ((p = getenv("OPENBLAS_LOOPS"))) | |||
loops = atoi(p); | |||
if ((p = getenv("OPENBLAS_INCX"))) | |||
inc_x = atoi(p); | |||
fprintf(stderr, "From : %3d To : %3d Step = %3d Inc_x = %d Loops = %d\n", from, to, step,inc_x,loops); | |||
fprintf(stderr, "From : %3d To : %3d Step = %3d Inc_x = %d Loops = %d\n", from, to, step, inc_x, loops); | |||
if (( x = (FLOAT *)malloc(sizeof(FLOAT) * to * abs(inc_x) * COMPSIZE)) == NULL){ | |||
fprintf(stderr,"Out of Memory!!\n");exit(1); | |||
if ((x = (FLOAT *)malloc(sizeof(FLOAT) * to * abs(inc_x) * COMPSIZE)) == NULL) | |||
{ | |||
fprintf(stderr, "Out of Memory!!\n"); | |||
exit(1); | |||
} | |||
#ifdef __linux | |||
@@ -151,39 +101,35 @@ int main(int argc, char *argv[]){ | |||
fprintf(stderr, " SIZE Flops\n"); | |||
for(m = from; m <= to; m += step) | |||
for (m = from; m <= to; m += step) | |||
{ | |||
timeg=0; | |||
timeg = 0; | |||
fprintf(stderr, " %6d : ", (int)m); | |||
fprintf(stderr, " %6d : ", (int)m); | |||
for (l = 0; l < loops; l++) | |||
{ | |||
for (l=0; l<loops; l++) | |||
{ | |||
for(i = 0; i < m * COMPSIZE * abs(inc_x); i++){ | |||
x[i] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5; | |||
} | |||
gettimeofday( &start, (struct timezone *)0); | |||
AMIN (&m, x, &inc_x); | |||
for (i = 0; i < m * COMPSIZE * abs(inc_x); i++) | |||
{ | |||
x[i] = ((FLOAT)rand() / (FLOAT)RAND_MAX) - 0.5; | |||
} | |||
gettimeofday( &stop, (struct timezone *)0); | |||
begin(); | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6; | |||
AMIN(&m, x, &inc_x); | |||
timeg += time1; | |||
end(); | |||
timeg += getsec(); | |||
} | |||
timeg /= loops; | |||
fprintf(stderr, | |||
" %10.2f MFlops %10.6f sec\n", | |||
COMPSIZE * sizeof(FLOAT) * 1. * (double)m / timeg * 1.e-6, timeg); | |||
" %10.2f MFlops %10.6f sec\n", | |||
COMPSIZE * sizeof(FLOAT) * 1. * (double)m / timeg * 1.e-6, timeg); | |||
} | |||
return 0; | |||
@@ -25,178 +25,108 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*****************************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
#undef ASUM | |||
#ifdef COMPLEX | |||
#ifdef DOUBLE | |||
#define ASUM BLASFUNC(dzasum) | |||
#define ASUM BLASFUNC(dzasum) | |||
#else | |||
#define ASUM BLASFUNC(scasum) | |||
#define ASUM BLASFUNC(scasum) | |||
#endif | |||
#else | |||
#ifdef DOUBLE | |||
#define ASUM BLASFUNC(dasum) | |||
#define ASUM BLASFUNC(dasum) | |||
#else | |||
#define ASUM BLASFUNC(sasum) | |||
#define ASUM BLASFUNC(sasum) | |||
#endif | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
int main(int argc, char *argv[]){ | |||
int main(int argc, char *argv[]) | |||
{ | |||
FLOAT *x; | |||
FLOAT result; | |||
blasint m, i; | |||
blasint inc_x=1; | |||
blasint inc_x = 1; | |||
int loops = 1; | |||
int l; | |||
char *p; | |||
int from = 1; | |||
int to = 200; | |||
int step = 1; | |||
#if defined(__WIN32__) || defined(__WIN64__) || !defined(_POSIX_TIMERS) | |||
struct timeval start, stop; | |||
double time1,timeg; | |||
#else | |||
struct timespec start = { 0, 0 }, stop = { 0, 0 }; | |||
int from = 1; | |||
int to = 200; | |||
int step = 1; | |||
double time1, timeg; | |||
#endif | |||
argc--;argv++; | |||
argc--; | |||
argv++; | |||
if (argc > 0) { from = atol(*argv); argc--; argv++;} | |||
if (argc > 0) { to = MAX(atol(*argv), from); argc--; argv++;} | |||
if (argc > 0) { step = atol(*argv); argc--; argv++;} | |||
if (argc > 0) | |||
{ | |||
from = atol(*argv); | |||
argc--; | |||
argv++; | |||
} | |||
if (argc > 0) | |||
{ | |||
to = MAX(atol(*argv), from); | |||
argc--; | |||
argv++; | |||
} | |||
if (argc > 0) | |||
{ | |||
step = atol(*argv); | |||
argc--; | |||
argv++; | |||
} | |||
if ((p = getenv("OPENBLAS_LOOPS"))) loops = atoi(p); | |||
if ((p = getenv("OPENBLAS_INCX"))) inc_x = atoi(p); | |||
if ((p = getenv("OPENBLAS_LOOPS"))) | |||
loops = atoi(p); | |||
if ((p = getenv("OPENBLAS_INCX"))) | |||
inc_x = atoi(p); | |||
fprintf(stderr, "From : %3d To : %3d Step = %3d Inc_x = %d Loops = %d\n", from, to, step,inc_x,loops); | |||
fprintf(stderr, "From : %3d To : %3d Step = %3d Inc_x = %d Loops = %d\n", from, to, step, inc_x, loops); | |||
if (( x = (FLOAT *)malloc(sizeof(FLOAT) * to * abs(inc_x) * COMPSIZE)) == NULL){ | |||
fprintf(stderr,"Out of Memory!!\n");exit(1); | |||
if ((x = (FLOAT *)malloc(sizeof(FLOAT) * to * abs(inc_x) * COMPSIZE)) == NULL) | |||
{ | |||
fprintf(stderr, "Out of Memory!!\n"); | |||
exit(1); | |||
} | |||
#ifdef __linux | |||
srandom(getpid()); | |||
#endif | |||
fprintf(stderr, " SIZE Flops\n"); | |||
for(m = from; m <= to; m += step) | |||
for (m = from; m <= to; m += step) | |||
{ | |||
timeg=0; | |||
fprintf(stderr, " %6d : ", (int)m); | |||
timeg = 0; | |||
for (l=0; l<loops; l++) | |||
{ | |||
fprintf(stderr, " %6d : ", (int)m); | |||
for(i = 0; i < m * COMPSIZE * abs(inc_x); i++){ | |||
x[i] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5; | |||
} | |||
#if defined(__WIN32__) || defined(__WIN64__) || !defined(_POSIX_TIMERS) | |||
gettimeofday( &start, (struct timezone *)0); | |||
#else | |||
clock_gettime(CLOCK_REALTIME, &start); | |||
#endif | |||
result = ASUM (&m, x, &inc_x); | |||
#if defined(__WIN32__) || defined(__WIN64__) || !defined(_POSIX_TIMERS) | |||
clock_gettime(CLOCK_REALTIME, &stop); | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6; | |||
#else | |||
gettimeofday( &stop, (struct timezone *)0); | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_nsec - start.tv_nsec)) / 1.e9; | |||
#endif | |||
timeg += time1; | |||
for (l = 0; l < loops; l++) | |||
{ | |||
for (i = 0; i < m * COMPSIZE * abs(inc_x); i++) | |||
{ | |||
x[i] = ((FLOAT)rand() / (FLOAT)RAND_MAX) - 0.5; | |||
} | |||
begin(); | |||
result = ASUM(&m, x, &inc_x); | |||
end(); | |||
timeg += getsec(); | |||
} | |||
if (loops >1) | |||
timeg /= loops; | |||
if (loops > 1) | |||
timeg /= loops; | |||
#ifdef COMPLEX | |||
fprintf(stderr, " %10.2f MFlops %10.6f sec\n", 4. * (double)m / timeg * 1.e-6, timeg); | |||
#else | |||
fprintf(stderr, " %10.2f MFlops %10.6f sec\n", 2. * (double)m / timeg * 1.e-6, timeg); | |||
#endif | |||
} | |||
return 0; | |||
@@ -25,13 +25,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*****************************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
#undef AXPBY | |||
@@ -49,71 +43,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
#endif | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
int main(int argc, char *argv[]){ | |||
FLOAT *x, *y; | |||
@@ -129,7 +58,6 @@ int main(int argc, char *argv[]){ | |||
int to = 200; | |||
int step = 1; | |||
struct timeval start, stop; | |||
double time1,timeg; | |||
argc--;argv++; | |||
@@ -176,16 +104,10 @@ int main(int argc, char *argv[]){ | |||
for (l=0; l<loops; l++) | |||
{ | |||
gettimeofday( &start, (struct timezone *)0); | |||
begin(); | |||
AXPBY (&m, alpha, x, &inc_x, beta, y, &inc_y ); | |||
gettimeofday( &stop, (struct timezone *)0); | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6; | |||
timeg += time1; | |||
end(); | |||
timeg += getsec(); | |||
} | |||
timeg /= loops; | |||
@@ -25,13 +25,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*****************************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
#undef AXPY | |||
@@ -49,71 +43,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
#endif | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
int main(int argc, char *argv[]){ | |||
FLOAT *x, *y; | |||
@@ -127,8 +56,6 @@ int main(int argc, char *argv[]){ | |||
int from = 1; | |||
int to = 200; | |||
int step = 1; | |||
struct timespec start, stop; | |||
double time1,timeg; | |||
argc--;argv++; | |||
@@ -175,13 +102,13 @@ int main(int argc, char *argv[]){ | |||
for(i = 0; i < m * COMPSIZE * abs(inc_y); i++){ | |||
y[i] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5; | |||
} | |||
clock_gettime( CLOCK_REALTIME, &start); | |||
begin(); | |||
AXPY (&m, alpha, x, &inc_x, y, &inc_y ); | |||
clock_gettime( CLOCK_REALTIME, &stop); | |||
end(); | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_nsec - start.tv_nsec)) * 1.e-9; | |||
time1 = getsec(); | |||
timeg += time1; | |||
@@ -0,0 +1,103 @@ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#include <time.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) || !defined(_POSIX_TIMERS) | |||
struct timeval start, stop; | |||
#else | |||
struct timespec start = { 0, 0 }, stop = { 0, 0 }; | |||
#endif | |||
double getsec() | |||
{ | |||
#if defined(__WIN32__) || defined(__WIN64__) || !defined(_POSIX_TIMERS) | |||
return (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6; | |||
#else | |||
return (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_nsec - start.tv_nsec)) * 1.e-9; | |||
#endif | |||
} | |||
void begin() { | |||
#if defined(__WIN32__) || defined(__WIN64__) || !defined(_POSIX_TIMERS) | |||
gettimeofday( &start, (struct timezone *)0); | |||
#else | |||
clock_gettime(CLOCK_REALTIME, &start); | |||
#endif | |||
} | |||
void end() { | |||
#if defined(__WIN32__) || defined(__WIN64__) || !defined(_POSIX_TIMERS) | |||
gettimeofday( &stop, (struct timezone *)0); | |||
#else | |||
clock_gettime(CLOCK_REALTIME, &stop); | |||
#endif | |||
} |
@@ -36,12 +36,7 @@ | |||
/* or implied, of The University of Texas at Austin. */ | |||
/*********************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
double fabs(double); | |||
@@ -71,41 +66,6 @@ double fabs(double); | |||
#endif | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
static __inline double getmflops(int ratio, int m, double secs){ | |||
double mm = (double)m; | |||
@@ -145,7 +105,6 @@ int main(int argc, char *argv[]){ | |||
FLOAT maxerr; | |||
struct timeval start, stop; | |||
double time1; | |||
argc--;argv++; | |||
@@ -220,20 +179,19 @@ int main(int argc, char *argv[]){ | |||
SYRK(uplo[uplos], trans[uplos], &m, &m, alpha, a, &m, beta, b, &m); | |||
gettimeofday( &start, (struct timezone *)0); | |||
begin(); | |||
POTRF(uplo[uplos], &m, b, &m, &info); | |||
gettimeofday( &stop, (struct timezone *)0); | |||
end(); | |||
if (info != 0) { | |||
fprintf(stderr, "Info = %d\n", info); | |||
exit(1); | |||
} | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6; | |||
time1 = getsec(); | |||
maxerr = 0.; | |||
if (!(uplos & 1)) { | |||
for (j = 0; j < m; j++) { | |||
@@ -25,13 +25,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*****************************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
#undef COPY | |||
@@ -49,71 +43,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
#endif | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
int main(int argc, char *argv[]){ | |||
FLOAT *x, *y; | |||
@@ -128,11 +57,9 @@ int main(int argc, char *argv[]){ | |||
int to = 200; | |||
int step = 1; | |||
struct timeval start, stop; | |||
double time1 = 0.0, timeg = 0.0; | |||
long nanos = 0; | |||
time_t seconds = 0; | |||
struct timespec time_start = { 0, 0 }, time_end = { 0, 0 }; | |||
argc--;argv++; | |||
@@ -176,15 +103,10 @@ int main(int argc, char *argv[]){ | |||
for (l=0; l<loops; l++) | |||
{ | |||
clock_gettime(CLOCK_REALTIME, &time_start); | |||
begin(); | |||
COPY (&m, x, &inc_x, y, &inc_y ); | |||
clock_gettime(CLOCK_REALTIME, &time_end); | |||
nanos = time_end.tv_nsec - time_start.tv_nsec; | |||
seconds = time_end.tv_sec - time_start.tv_sec; | |||
time1 = seconds + nanos / 1.e9; | |||
timeg += time1; | |||
end(); | |||
timeg += getsec(); | |||
} | |||
timeg /= loops; | |||
@@ -25,89 +25,16 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*****************************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
#undef DOT | |||
#ifdef DOUBLE | |||
#define DOT BLASFUNC(ddot) | |||
#else | |||
#define DOT BLASFUNC(sdot) | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
int main(int argc, char *argv[]){ | |||
FLOAT *x, *y; | |||
@@ -169,15 +96,12 @@ int main(int argc, char *argv[]){ | |||
for(i = 0; i < m * COMPSIZE * abs(inc_y); i++){ | |||
y[i] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5; | |||
} | |||
gettimeofday( &start, (struct timezone *)0); | |||
begin(); | |||
result = DOT (&m, x, &inc_x, y, &inc_y ); | |||
gettimeofday( &stop, (struct timezone *)0); | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6; | |||
timeg += time1; | |||
end(); | |||
timeg += getsec(); | |||
} | |||
@@ -36,13 +36,7 @@ | |||
/* or implied, of The University of Texas at Austin. */ | |||
/*********************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
#undef GEEV | |||
@@ -74,71 +68,6 @@ extern void GEEV( char* jobvl, char* jobvr, blasint* n, FLOAT* a, | |||
FLOAT* vr, blasint* ldvr, FLOAT* work, blasint* lwork, FLOAT *rwork, blasint* info ); | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
int main(int argc, char *argv[]){ | |||
FLOAT *a,*vl,*vr,*wi,*wr,*work,*rwork; | |||
@@ -154,7 +83,6 @@ int main(int argc, char *argv[]){ | |||
int to = 200; | |||
int step = 1; | |||
struct timeval start, stop; | |||
double time1; | |||
argc--;argv++; | |||
@@ -223,7 +151,7 @@ int main(int argc, char *argv[]){ | |||
for(m = from; m <= to; m += step){ | |||
fprintf(stderr, " %6d : ", (int)m); | |||
gettimeofday( &start, (struct timezone *)0); | |||
begin(); | |||
lwork = -1; | |||
#ifndef COMPLEX | |||
@@ -239,14 +167,14 @@ int main(int argc, char *argv[]){ | |||
GEEV (&job, &jobr, &m, a, &m, wr, vl, &m, vr, &m, work, &lwork,rwork, &info); | |||
#endif | |||
gettimeofday( &stop, (struct timezone *)0); | |||
end(); | |||
if (info) { | |||
fprintf(stderr, "failed to compute eigenvalues .. %d\n", info); | |||
exit(1); | |||
} | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6; | |||
time1 = getsec(); | |||
fprintf(stderr, | |||
" %10.2f MFlops : %10.2f Sec : %d\n", | |||
@@ -25,13 +25,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*****************************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
#undef GEMM | |||
@@ -55,71 +49,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
int main(int argc, char *argv[]){ | |||
IFLOAT *a, *b; | |||
@@ -139,7 +68,6 @@ int main(int argc, char *argv[]){ | |||
int to = 200; | |||
int step = 1; | |||
struct timeval start, stop; | |||
double time1, timeg; | |||
argc--;argv++; | |||
@@ -228,14 +156,14 @@ int main(int argc, char *argv[]){ | |||
ldc = m; | |||
fprintf(stderr, " M=%4d, N=%4d, K=%4d : ", (int)m, (int)n, (int)k); | |||
gettimeofday( &start, (struct timezone *)0); | |||
begin(); | |||
for (j=0; j<loops; j++) { | |||
GEMM (&transa, &transb, &m, &n, &k, alpha, a, &lda, b, &ldb, beta, c, &ldc); | |||
} | |||
gettimeofday( &stop, (struct timezone *)0); | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6; | |||
end(); | |||
time1 = getsec(); | |||
timeg = time1/loops; | |||
fprintf(stderr, | |||
@@ -25,13 +25,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
*****************************************************************************/ | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#ifdef __CYGWIN32__ | |||
#include <sys/time.h> | |||
#endif | |||
#include "common.h" | |||
#include "bench.h" | |||
#undef GEMM | |||
@@ -53,71 +47,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
#endif | |||
#if defined(__WIN32__) || defined(__WIN64__) | |||
#ifndef DELTA_EPOCH_IN_MICROSECS | |||
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL | |||
#endif | |||
int gettimeofday(struct timeval *tv, void *tz){ | |||
FILETIME ft; | |||
unsigned __int64 tmpres = 0; | |||
static int tzflag; | |||
if (NULL != tv) | |||
{ | |||
GetSystemTimeAsFileTime(&ft); | |||
tmpres |= ft.dwHighDateTime; | |||
tmpres <<= 32; | |||
tmpres |= ft.dwLowDateTime; | |||
/*converting file time to unix epoch*/ | |||
tmpres /= 10; /*convert into microseconds*/ | |||
tmpres -= DELTA_EPOCH_IN_MICROSECS; | |||
tv->tv_sec = (long)(tmpres / 1000000UL); | |||
tv->tv_usec = (long)(tmpres % 1000000UL); | |||
} | |||
return 0; | |||
} | |||
#endif | |||
#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0 | |||
static void *huge_malloc(BLASLONG size){ | |||
int shmid; | |||
void *address; | |||
#ifndef SHM_HUGETLB | |||
#define SHM_HUGETLB 04000 | |||
#endif | |||
if ((shmid =shmget(IPC_PRIVATE, | |||
(size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1), | |||
SHM_HUGETLB | IPC_CREAT |0600)) < 0) { | |||
printf( "Memory allocation failed(shmget).\n"); | |||
exit(1); | |||
} | |||
address = shmat(shmid, NULL, SHM_RND); | |||
if ((BLASLONG)address == -1){ | |||
printf( "Memory allocation failed(shmat).\n"); | |||
exit(1); | |||
} | |||
shmctl(shmid, IPC_RMID, 0); | |||
return address; | |||
} | |||
#define malloc huge_malloc | |||
#endif | |||
int main(int argc, char *argv[]){ | |||
FLOAT *a, *b, *c; | |||
@@ -187,16 +116,12 @@ int main(int argc, char *argv[]){ | |||
} | |||
} | |||
gettimeofday( &start, (struct timezone *)0); | |||
begin(); | |||
GEMM (&trans, &trans, &m, &m, &m, alpha, a, &m, b, &m, beta, c, &m ); | |||
gettimeofday( &stop, (struct timezone *)0); | |||
time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6; | |||
timeg += time1; | |||
end(); | |||
timeg += getsec(); | |||
} | |||
timeg /= loops; | |||