Skip to content

Commit

Permalink
Linux: more changes required for compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Bulat-Ziganshin committed May 11, 2017
1 parent 07ff8e4 commit 405d86e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
6 changes: 3 additions & 3 deletions LargePages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ T* VAlloc (uint64_t size)
{
if (verbose) printf("Allocated %.0lf MiB\n", (size*sizeof(T))/1048576.0);
return (T*) malloc(size*sizeof(T));
}
}

template< class T >
void VFree( T* p )
{
free(p)
free(p);
}

#endif // _WIN32

1 change: 1 addition & 0 deletions RS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <iostream>
#include <algorithm>
#include <stdint.h>
#include <cstddef>
#include <string.h>
#include <math.h>
#include <cassert>
Expand Down
24 changes: 12 additions & 12 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
g++ -std=c++14 -m64 -O3 main.cpp -ontt64g-avx2 -static -s -fopenmp -mavx2 -DSIMD=AVX2
g++ -std=c++14 -m64 -O3 main.cpp -ontt64g-sse2 -static -s -fopenmp -DSIMD=SSE2
g++ -std=c++14 -m64 -O3 main.cpp -ontt64g -static -s -fopenmp
g++ -std=c++1y -m64 -O3 main.cpp -ontt64g-avx2 -static -s -fopenmp -mavx2 -DSIMD=AVX2
g++ -std=c++1y -m64 -O3 main.cpp -ontt64g-sse2 -static -s -fopenmp -DSIMD=SSE2
g++ -std=c++1y -m64 -O3 main.cpp -ontt64g -static -s -fopenmp

g++ -std=c++14 -m32 -O3 main.cpp -ontt32g-avx2 -static -s -fopenmp -mavx2 -DSIMD=AVX2
g++ -std=c++14 -m32 -O3 main.cpp -ontt32g-sse2 -static -s -fopenmp -msse2 -DSIMD=SSE2
g++ -std=c++14 -m32 -O3 main.cpp -ontt32g -static -s -fopenmp -mmmx
g++ -std=c++1y -m32 -O3 main.cpp -ontt32g-avx2 -static -s -fopenmp -mavx2 -DSIMD=AVX2
g++ -std=c++1y -m32 -O3 main.cpp -ontt32g-sse2 -static -s -fopenmp -msse2 -DSIMD=SSE2
g++ -std=c++1y -m32 -O3 main.cpp -ontt32g -static -s -fopenmp -mmmx

g++ -std=c++14 -m64 -O3 RS.cpp -ors64g-avx2 -static -s -fopenmp -mavx2 -DSIMD=AVX2
g++ -std=c++14 -m64 -O3 RS.cpp -ors64g-sse2 -static -s -fopenmp -DSIMD=SSE2
g++ -std=c++14 -m64 -O3 RS.cpp -ors64g -static -s -fopenmp
g++ -std=c++1y -m64 -O3 RS.cpp -ors64g-avx2 -static -s -fopenmp -mavx2 -DSIMD=AVX2
g++ -std=c++1y -m64 -O3 RS.cpp -ors64g-sse2 -static -s -fopenmp -DSIMD=SSE2
g++ -std=c++1y -m64 -O3 RS.cpp -ors64g -static -s -fopenmp

g++ -std=c++14 -m32 -O3 RS.cpp -ors32g-avx2 -static -s -fopenmp -mavx2 -DSIMD=AVX2
g++ -std=c++14 -m32 -O3 RS.cpp -ors32g-sse2 -static -s -fopenmp -msse2 -DSIMD=SSE2
g++ -std=c++14 -m32 -O3 RS.cpp -ors32g -static -s -fopenmp -mmmx
g++ -std=c++1y -m32 -O3 RS.cpp -ors32g-avx2 -static -s -fopenmp -mavx2 -DSIMD=AVX2
g++ -std=c++1y -m32 -O3 RS.cpp -ors32g-sse2 -static -s -fopenmp -msse2 -DSIMD=SSE2
g++ -std=c++1y -m32 -O3 RS.cpp -ors32g -static -s -fopenmp -mmmx
1 change: 1 addition & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// Benchmarks and tests of GF(p) and NTT implementations
#include <iostream>
#include <algorithm>
#include <cstddef>
#include <stdint.h>
#include <string.h>
#include <math.h>
Expand Down
8 changes: 8 additions & 0 deletions wall_clock_timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <windows.h>
#else
#include <sys/time.h>
#include <sys/resource.h>
#endif

#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
Expand Down Expand Up @@ -64,10 +65,17 @@ double GetTimer()
// Returns number of seconds spent in the current process
void GetProcessKernelUserTimes (double *KernelTime, double *UserTime)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
FILETIME kt, ut, x, y;
int ok = GetProcessTimes(GetCurrentProcess(),&x,&y,&kt,&ut);
*KernelTime = !ok? -1 : ((((unsigned long long)(kt.dwHighDateTime) << 32) + kt.dwLowDateTime)) / 1e7;
*UserTime = !ok? -1 : ((((unsigned long long)(ut.dwHighDateTime) << 32) + ut.dwLowDateTime)) / 1e7;
#else
struct rusage usage;
int res = getrusage (RUSAGE_SELF, &usage);
*KernelTime = res? -1 : (usage.ru_stime.tv_sec + usage.ru_stime.tv_usec/1e6);
*UserTime = res? -1 : (usage.ru_utime.tv_sec + usage.ru_utime.tv_usec/1e6);
#endif
}
#endif // TIMER_H

Expand Down

0 comments on commit 405d86e

Please sign in to comment.