-
Notifications
You must be signed in to change notification settings - Fork 12.2k
examples : add compiler version and target to build info #2998
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
045718f
examples : refactor build info prints into print_build_info
cebtenzzre b1593bc
build-info : fix newlines correctly
cebtenzzre 98a6004
build-info : cleanup
cebtenzzre 64c87bf
examples : add compiler version and target to build info
cebtenzzre bbb9511
Merge branch 'master' of https://github.com/ggerganov/llama.cpp into …
cebtenzzre 7aa146a
fix build when git is unavailable
cebtenzzre 6adc3b6
do not use pipefail bashism
cebtenzzre e75ba80
move comment
cebtenzzre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -492,22 +492,22 @@ main: examples/main/main.cpp build-info.h ggml. | |
@echo '==== Run ./main -h for help. ====' | ||
@echo | ||
|
||
simple: examples/simple/simple.cpp build-info.h ggml.o llama.o common.o $(OBJS) | ||
simple: examples/simple/simple.cpp ggml.o llama.o common.o $(OBJS) | ||
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) | ||
|
||
quantize: examples/quantize/quantize.cpp build-info.h ggml.o llama.o $(OBJS) | ||
quantize: examples/quantize/quantize.cpp ggml.o llama.o $(OBJS) | ||
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) | ||
|
||
quantize-stats: examples/quantize-stats/quantize-stats.cpp build-info.h ggml.o llama.o $(OBJS) | ||
quantize-stats: examples/quantize-stats/quantize-stats.cpp ggml.o llama.o $(OBJS) | ||
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) | ||
|
||
perplexity: examples/perplexity/perplexity.cpp build-info.h ggml.o llama.o common.o $(OBJS) | ||
perplexity: examples/perplexity/perplexity.cpp ggml.o llama.o common.o $(OBJS) | ||
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) | ||
|
||
embedding: examples/embedding/embedding.cpp build-info.h ggml.o llama.o common.o $(OBJS) | ||
embedding: examples/embedding/embedding.cpp ggml.o llama.o common.o $(OBJS) | ||
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) | ||
|
||
save-load-state: examples/save-load-state/save-load-state.cpp build-info.h ggml.o llama.o common.o $(OBJS) | ||
save-load-state: examples/save-load-state/save-load-state.cpp ggml.o llama.o common.o $(OBJS) | ||
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) | ||
|
||
server: examples/server/server.cpp examples/server/httplib.h examples/server/json.hpp examples/server/index.html.hpp examples/server/index.js.hpp examples/server/completion.js.hpp build-info.h ggml.o llama.o common.o grammar-parser.o $(OBJS) | ||
|
@@ -547,7 +547,7 @@ metal: examples/metal/metal.cpp ggml.o $(OBJS) | |
endif | ||
|
||
build-info.h: $(wildcard .git/index) scripts/build-info.sh | ||
@sh scripts/build-info.sh > [email protected] | ||
@sh scripts/build-info.sh $(CC) > [email protected] | ||
@if ! cmp -s [email protected] $@; then \ | ||
mv [email protected] $@; \ | ||
else \ | ||
|
@@ -560,7 +560,7 @@ build-info.h: $(wildcard .git/index) scripts/build-info.sh | |
|
||
tests: $(TEST_TARGETS) | ||
|
||
benchmark-matmult: examples/benchmark/benchmark-matmult.cpp build-info.h ggml.o $(OBJS) | ||
benchmark-matmult: examples/benchmark/benchmark-matmult.cpp ggml.o $(OBJS) | ||
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS) | ||
./$@ | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#include "common.h" | ||
#include "llama.h" | ||
#include "build-info.h" | ||
|
||
#include <cassert> | ||
#include <cinttypes> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
|
||
#include "common.h" | ||
#include "llama.h" | ||
#include "build-info.h" | ||
|
||
extern "C" { | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#include "build-info.h" | ||
|
||
#include "common.h" | ||
#include "llama.h" | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
#!/bin/sh | ||
|
||
BUILD_NUMBER="0" | ||
BUILD_COMMIT="unknown" | ||
CC=$1 | ||
|
||
REV_LIST=$(git rev-list --count HEAD) | ||
if [ $? -eq 0 ]; then | ||
BUILD_NUMBER=$REV_LIST | ||
build_number="0" | ||
build_commit="unknown" | ||
build_compiler="unknown" | ||
build_target="unknown" | ||
|
||
if out=$(git rev-list --count HEAD); then | ||
# git is broken on WSL so we need to strip extra newlines | ||
build_number=$(printf '%s' "$out" | tr -d '\n') | ||
fi | ||
|
||
if out=$(git rev-parse --short HEAD); then | ||
build_commit=$(printf '%s' "$out" | tr -d '\n') | ||
fi | ||
|
||
if out=$($CC --version | head -1); then | ||
build_compiler=$out | ||
fi | ||
|
||
REV_PARSE=$(git rev-parse --short HEAD) | ||
if [ $? -eq 0 ]; then | ||
BUILD_COMMIT=$REV_PARSE | ||
if out=$($CC -dumpmachine); then | ||
build_target=$out | ||
fi | ||
|
||
echo "#ifndef BUILD_INFO_H" | ||
echo "#define BUILD_INFO_H" | ||
echo "" | ||
echo "#define BUILD_NUMBER $BUILD_NUMBER" | tr -d '\n' | ||
echo "" | ||
echo "#define BUILD_COMMIT \"$BUILD_COMMIT\"" | tr -d '\n' | ||
echo "" | ||
echo | ||
echo "#define BUILD_NUMBER $build_number" | ||
echo "#define BUILD_COMMIT \"$build_commit\"" | ||
echo "#define BUILD_COMPILER \"$build_compiler\"" | ||
echo "#define BUILD_TARGET \"$build_target\"" | ||
echo | ||
echo "#endif // BUILD_INFO_H" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.