Bulat-Ziganshin/FastECC

No make/cmake/configure file? Only Visual Studio supported?

Closed this issue · 9 comments

Is this code supposed to be Microsoft Windows specific? I was expecting to see a cmake, make, configure or something similar to allow compiling on other platforms. Currently it looks like the compile script assumes Microsoft Visual Studio.

i just pushed two commits. This provide changes to make code portable and compile.sh scrpit that should be suitable for linux, Mac and anything else. Unfortunately, i don't have c++14 compatible linux gcc at hand so can't check it myself

if it will work for you, can you please make CMake script yourself and push it here? I'm not regular CMake user

I can write a make file for you, once it compiles. Currently:
bill@left:~/git/FastECC$ g++ -std=c++1y -m64 -O3 main.cpp -ontt64g-avx2 -static -s -fopenmp -mavx2 -DSIMD=AVX2
In file included from main.cpp:18:0:
ntt.cpp:13:1: error: ‘__forceinline’ does not name a type
__forceinline void NTT2 (T& restrict f0, T& restrict f1)
^
ntt.cpp:23:1: error: ‘__forceinline’ does not name a type
__forceinline void NTT3 (T& restrict f0, T& restrict f1, T& restrict f2)
^
ntt.cpp:47:1: error: ‘__forceinline’ does not name a type
__forceinline void NTT4 (T& restrict f0, T& restrict f1, T& restrict f2, T& restrict f3)
^
ntt.cpp:97:1: error: ‘__forceinline’ does not name a type
__forceinline void NTT6 (T& restrict f0, T& restrict f1, T& restrict f2,
^
ntt.cpp:111:1: error: ‘__forceinline’ does not name a type
__forceinline void NTT9 (T& restrict f0, T& restrict f1, T& restrict f2,
^
ntt.cpp: In instantiation of ‘void NTT9(T**, size_t, size_t) [with T = unsigned int; T P = 65537u; bool InvNTT = false; size_t = long unsigned int]’:
main.cpp:268:80: required from ‘BenchNTT(bool, bool, size_t, size_t, const char*)::<lambda()> [with T = unsigned int; T P = 65537u]’

Oh, several files reference NTT.cpp, but the file int he repo is ntt.cpp. Linux (or at least most filesystems on linux) are case sensitive. Even with that fixed I get the above errors.

sorry for that. i just fixed these problems and checked that it compiles with gcc 6.2, at least 64-bit versions

Compiles for me, do you want a pull request to add the makefile? Why do you build 32 bit binaries? Seems kinda weird, not sure a 32 bit x86 has been build in the last decade or ore.

yes, adding makefile/cmake or anything else you are using for build will improve things

32-bit windows is still used on low-end computers having 1-4 GB of RAM. for Linux, it may be less important since it is usually used by "power users". also, 32-bit software always work on 64-bit Windows installations, so many software (that doesn't need anything 64-bit specific) is shipped as 32-bit versions

feel free to omit 32-bit linux builds from your Makefile, if you think it's Right Thing

Right, but 32 bit computers don't need -m32 to build 32 bit binaries. While windows is rather primitive and behind the times there are substantial performance and stability/security penalties to 32 bit binaries. Half the registers, no page protection, etc.

Pull request incoming.

paging is supported since 80386 (1985)

i build executables for other users too, so i use -m32 and -static. i propose to keep them in my compile.sh and drop in Makefile (as you already done), so users will have a choice

Up to you, seems kind of redundant. The comment mentioned:
#add -m32 if trying to build 32 bit binaries on 64 bit machines
CFLAGS=-std=c++1y -O3 -s -fopenmp

The compile.sh script seems rather error prone, any changes need to be made in many places.
For example some binaries are compiled with "-DSIMD=SSE2", others with "-msse2 -DSIMD=SSE2". I guess i's possible that was intentional.

yeah, that is intentional. SSE2 is a part of x64 specs, so it's always avilable - no need to speicfy -msse2 although it's harmless. But it's required for x86 builds. Your Makefile is generic, so you specified -msse2 - it's right thing

Without -DSIMD, program selects unvectorizable codepath. It's slower than (always available) SSE2 on x64, but interesting for my benchmarks

For practical needs, it's hard to find sse2-less cpu nowadays :)