From 363186c3ae0dc96efb01e9a8d25ad8c589a23c3c Mon Sep 17 00:00:00 2001 From: Stephen Akridge Date: Wed, 13 Nov 2019 08:19:03 -0800 Subject: [PATCH] Consolidate perftime header --- src/{cuda-crypt => common}/perftime.h | 0 src/cuda-ecc-ed25519/perftime.h | 50 --------------------------- src/gpu-common.mk | 2 +- 3 files changed, 1 insertion(+), 51 deletions(-) rename src/{cuda-crypt => common}/perftime.h (100%) delete mode 100644 src/cuda-ecc-ed25519/perftime.h diff --git a/src/cuda-crypt/perftime.h b/src/common/perftime.h similarity index 100% rename from src/cuda-crypt/perftime.h rename to src/common/perftime.h diff --git a/src/cuda-ecc-ed25519/perftime.h b/src/cuda-ecc-ed25519/perftime.h deleted file mode 100644 index fddd509..0000000 --- a/src/cuda-ecc-ed25519/perftime.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef PERFTIME_H -#define PERFTIME_H - -#ifdef USE_RDTSC -static inline uint64_t rdtsc() -{ - unsigned int hi, lo; - __asm__ volatile("rdtsc" : "=a" (lo), "=d" (hi)); - return ((uint64_t)hi << 32) | lo; -} - -typedef struct { - uint64_t count; -} perftime_t; - -#elif defined(USE_CLOCK_GETTIME) -#include -typedef struct timespec perftime_t; -#else -#include -typedef struct timeval perftime_t; -#endif - -static int get_time(perftime_t* t) { -#ifdef USE_RDTSC - t->count = rdtsc(); - return 0; -#elif defined(USE_CLOCK_GETTIME) - return clock_gettime(CLOCK_MONOTONIC_RAW, t); - //return clock_gettime(CLOCK_PROCESS_CPUTIME_ID, t); -#else - return gettimeofday(t, NULL /* timezone */); -#endif -} - -static double get_us(const perftime_t* time) { -#ifdef USE_RDTSC - return time->count; -#elif defined(USE_CLOCK_GETTIME) - return ((time->tv_nsec/1000) + (double)time->tv_sec * 1000000); -#else - return (time->tv_usec + (double)time->tv_sec * 1000000); -#endif -} - -static double get_diff(const perftime_t* start, const perftime_t* end) { - return get_us(end) - get_us(start); -} - -#endif diff --git a/src/gpu-common.mk b/src/gpu-common.mk index 460b14e..a29595f 100644 --- a/src/gpu-common.mk +++ b/src/gpu-common.mk @@ -2,6 +2,6 @@ NVCC:=nvcc GPU_PTX_ARCH:=compute_35 GPU_ARCHS?=sm_37,sm_50,sm_61,sm_70 GPU_CFLAGS:=--gpu-code=$(GPU_ARCHS),$(GPU_PTX_ARCH) --gpu-architecture=$(GPU_PTX_ARCH) -CFLAGS_release:=--ptxas-options=-v $(GPU_CFLAGS) -O3 -Xcompiler "-Wall -Werror -fPIC -Wno-strict-aliasing" +CFLAGS_release:=-Icommon --ptxas-options=-v $(GPU_CFLAGS) -O3 -Xcompiler "-Wall -Werror -fPIC -Wno-strict-aliasing" CFLAGS_debug:=$(CFLAGS_release) -g CFLAGS:=$(CFLAGS_$V)