-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation fixes #70
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
NUM_NODES = 10 | ||
WORLD_SIZE = 1000 | ||
|
||
COMMON_CFLAGS = -std=gnu99 -O2 -march=native -fomit-frame-pointer -Wall -Wextra | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -march implies -mtune, see https://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/i386-and-x86_002d64-Options.html There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not documented to work like that in the GCC ARM docs. Also, the options accepted by -march are generic architectures, while the options accepted by -mtune are specific cores. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But previously the makefile didn't even specify |
||
COMMON_CXXFLAGS = -std=c++14 -Wall -O2 -march=native | ||
|
||
buildall: c_fast c_fast_arm f03 c fsharp cpp_gcc cpp_clang cpp_cached racket csharp java haskell ocaml lisp rust rust_unsafe go gccgo d nim oraclejava crystal | ||
|
||
clean: | ||
rm -f c_fast_arm c_fast f03 fs.exe cpp_gcc cpp_clang cpp_plain cpp_cached \ | ||
cs.exe jv.class hs ml lisp rs rs_unsafe go gccgo d nim crystal d \ | ||
c | ||
# C targets | ||
c: c.c | ||
$(CC) $(COMMON_CFLAGS) c.c -o c -DUSE_HIGHBIT | ||
|
||
c_fast_arm: c_fast.c | ||
gcc -marm -falign-functions=32 -g -std=gnu99 -O2 -mcpu=native -fomit-frame-pointer c_fast.c -o ./c_fast_arm | ||
$(CC) -marm -falign-functions=32 $(COMMON_CFLAGS) c_fast.c -o ./c_fast_arm | ||
|
||
c_fast: c_fast.c | ||
gcc -falign-functions=32 -g -std=gnu99 -O2 -mcpu=native -fomit-frame-pointer c_fast.c -o ./c_fast | ||
$(CC) -falign-functions=32 $(COMMON_CFLAGS) c_fast.c -o ./c_fast | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The compiler was hardcoded to gcc on purpose, because I haven't evaluated or optimised clang's output for this implementation and therefore the code or flags might need some tweaks to achieve the optimum performance. I don't insist on keeping it that way, but maybe adding a comment about that would be in order. |
||
|
||
# Other | ||
f03: f03.f03 | ||
gfortran -O2 -mcpu=native f03.f03 -o f03 | ||
|
||
fsharp: fs.fs | ||
fsharpc fs.fs | ||
|
||
cpp_gcc: cpp.cpp | ||
g++ cpp.cpp -std=c++14 -Wall -O2 -mcpu=native -DCOMPILER='"gcc"' -o cpp_gcc | ||
g++ cpp.cpp $(COMMON_CXXFLAGS) -DCOMPILER='"gcc"' -o cpp_gcc | ||
|
||
cpp_clang: cpp.cpp | ||
clang++ cpp.cpp -std=c++14 -Wall -O2 -mcpu=native -DCOMPILER='"clang"' -o cpp_clang | ||
clang++ cpp.cpp $(COMMON_CXXFLAGS) -DCOMPILER='"clang"' -o cpp_clang | ||
|
||
cpp_plain: cpp_plain.cpp | ||
clang++ cpp_plain.cpp -std=c++14 -Wall -O2 -mcpu=native -DCOMPILER='"clang"' -o cpp_plain | ||
clang++ cpp_plain.cpp $(COMMON_CXXFLAGS) -DCOMPILER='"clang"' -o cpp_plain | ||
|
||
cpp_cached: cpp_cached.cpp | ||
clang++ cpp_cached.cpp -std=c++14 -Wall -O2 -mcpu=native -o cpp_cached | ||
|
||
c: c.c | ||
gcc -g -std=gnu99 -Wall -Wextra c.c -O2 -mcpu=native -o c -DUSE_HIGHBIT | ||
clang++ cpp_cached.cpp $(COMMON_CXXFLAGS) -o cpp_cached | ||
|
||
racket: rkt.rkt | ||
raco exe rkt.rkt | ||
|
@@ -59,7 +67,7 @@ rust: rs.rs | |
rustc rs.rs --opt-level=3 -C no-stack-check | ||
|
||
rust_unsafe: rs_unsafe.rs | ||
rustc rs_unsafe.rs --opt-level=3 | ||
rustc rs_unsafe.rs --opt-level=3 | ||
|
||
go: go.go | ||
go build go.go | ||
|
@@ -80,7 +88,7 @@ nim: nim.nim | |
nim c --cc:clang --passC:-mcpu=native -d:release nim.nim | ||
|
||
scala: scala.scala | ||
scalac scala.scala | ||
scalac scala.scala | ||
|
||
graphbuilder: mkgraph.go | ||
go build mkgraph.go | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's incorrect on 32-bit architectures (including Aarch32 and X86), on which a long unsigned int is a uint32_t.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But ms has type uint64_t!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if that was not clear.
ms
has typeuint64_t
, which is why it has to be printed with%llu
(which is a 64-bit unsigned integer both on 32-bit and 64-bit machines), and not with%lu
(which is a 32-bit unsigned integer on (some) 32-bit machines and a 64-bit unsigned integer on 64-bit machines). These implementations are supposed to run on AArch32 and x86-64.