Skip to content

Commit 3f5893e

Browse files
committed
try fix build errors; minor cleanup
1 parent 426b476 commit 3f5893e

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,12 @@ if (LLAMA_BLAS)
158158
endif()
159159
set(BLA_VENDOR ${LLAMA_BLAS_VENDOR})
160160
find_package(BLAS)
161-
if (BLAS_FOUND)
161+
if (BLAS_FOUND)
162162
message(STATUS "BLAS found, Libraries: ${BLAS_LIBRARIES}")
163163

164164
add_compile_options(${BLAS_LINKER_FLAGS})
165165
add_compile_definitions(GGML_USE_OPENBLAS)
166+
add_compile_definitions(GGML_BLAS_VENDOR="${LLAMA_BLAS_VENDOR}")
166167
set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} ${BLAS_LIBRARIES})
167168

168169
message("${BLAS_LIBRARIES} ${BLAS_INCLUDE_DIRS}")
@@ -370,6 +371,8 @@ endif()
370371
add_library(ggml OBJECT
371372
ggml.c
372373
ggml.h
374+
ggml-tune.c
375+
ggml-tune.h
373376
${GGML_CUDA_SOURCES}
374377
${GGML_OPENCL_SOURCES})
375378

Makefile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,8 @@ ifdef LLAMA_OPENBLAS
132132
LDFLAGS += -lopenblas -L/usr/local/opt/openblas/lib
133133
else
134134
ifneq ($(shell grep -e "Ubuntu" -e "ID_LIKE=debian" /etc/os-release 2>/dev/null),)
135-
# libopenblas64-pthread-dev on ubuntu.
136-
CFLAGS += -I/usr/include/x86_64-linux-gnu/openblas64-pthread
137-
LDFLAGS += -lopenblas64 -L/usr/lib/x86_64-linux-gnu/openblas64-pthread
135+
CFLAGS += $(pkg-config openblas --cflags)
136+
LDFLAGS += $(pkg-config openblas --libs)
138137
else
139138
CFLAGS += -I/usr/local/include/openblas -I/usr/include/openblas
140139
ifneq ($(shell grep -e "Arch Linux" -e "ID_LIKE=arch" /etc/os-release 2>/dev/null),)
@@ -147,13 +146,8 @@ ifdef LLAMA_OPENBLAS
147146
endif
148147
ifdef LLAMA_BLIS
149148
CFLAGS += -DGGML_USE_OPENBLAS -I/usr/local/include/blis -I/usr/include/blis
150-
CFLAGS += -DGGML_BLAS_VENDOR_BLIS
149+
CFLAGS += -DGGML_BLAS_VENDOR="\"FLAME\""
151150
LDFLAGS += -lblis -L/usr/local/lib
152-
ifeq ($(UNAME_S),Darwin)
153-
# blis installed with Homebew on macOS.
154-
CFLAGS += -I/usr/local/opt/blis/include
155-
LDFLAGS += -L/usr/local/opt/blis/lib
156-
endif
157151
endif
158152
ifdef LLAMA_CUBLAS
159153
CFLAGS += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/x86_64-linux/include

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ else()
3737
add_subdirectory(save-load-state)
3838
add_subdirectory(benchmark)
3939
add_subdirectory(baby-llama)
40+
add_subdirectory(mulmat-tune)
4041
if(LLAMA_BUILD_SERVER)
4142
add_subdirectory(server)
4243
endif()

examples/mulmat-tune/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set(TARGET mulmat-tune)
2+
add_executable(${TARGET} mulmat-tune.c)
3+
target_link_libraries(${TARGET} PRIVATE ggml ${CMAKE_THREAD_LIBS_INIT})
4+
target_compile_features(${TARGET} PRIVATE c_std_11)
5+
if(TARGET BUILD_INFO)
6+
add_dependencies(${TARGET} BUILD_INFO)
7+
endif()

examples/mulmat-tune/mulmat-tune.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define UNUSED(x) (void)(x)
1212

1313
static int tune_time_min(const int *a, int len);
14-
static void print_blas_build_tips(void);
14+
static void print_build_tips(void);
1515
static void progress(int i, int n);
1616
static bool prompt_yes_no(const char *prompt);
1717

@@ -52,7 +52,7 @@ static void usage(char *prog) {
5252

5353
printf("\n");
5454

55-
print_blas_build_tips();
55+
print_build_tips();
5656
}
5757

5858
// main
@@ -62,7 +62,7 @@ int main(int argc, char **argv) {
6262
int n_builtin_backends = ggml_get_builtin_backends(builtin_backends);
6363
if (n_builtin_backends == 0) {
6464
fprintf(stderr, "ERROR: this program was not built with any BLAS.\n");
65-
print_blas_build_tips();
65+
print_build_tips();
6666
exit(1);
6767
}
6868

@@ -353,7 +353,7 @@ void cmd_tune(struct ggml_mulmat_tune *tune, int n_pass, bool verbose) {
353353
void *q_buf = NULL;
354354
void *wdata = NULL;
355355

356-
// alloc q4_0_buf and wdata with max size.
356+
// alloc q_buf and wdata with max size.
357357
{
358358
int max_NxK = 0;
359359
for (int i = 0; i < tune->n_shapes; i++) {
@@ -532,7 +532,7 @@ void cmd_tune(struct ggml_mulmat_tune *tune, int n_pass, bool verbose) {
532532
free(q_buf);
533533
}
534534

535-
static void print_blas_build_tips(void) {
535+
static void print_build_tips(void) {
536536
const char *a = "LLAMA_NO_ACCELERATE";
537537
fprintf(stderr, "Tips on how to build with various backend vendors:\n\n");
538538
fprintf(stderr, "CUDA: make clean; LLAMA_CUBLAS=1 make\n");

ggml-tune.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,17 +416,15 @@ const char *ggml_get_backend_vendor(void) {
416416
const char *vendor = NULL;
417417
#if defined(GGML_USE_CUBLAS)
418418
vendor = "CUBLAS";
419-
#endif
420-
421-
#if defined(GGML_USE_CLBLAST)
419+
#elif defined(GGML_USE_CLBLAST)
422420
vendor = "CLBLAST";
423421
#endif
424422

425423
#if defined(GGML_USE_ACCELERATE)
426424
vendor = "ACCELERATE";
427425
#elif defined(GGML_USE_OPENBLAS)
428-
#if defined(GGML_BLAS_VENDOR_BLIS)
429-
vendor = "BLIS";
426+
#if defined(GGML_BLAS_VENDOR)
427+
vendor = GGML_BLAS_VENDOR;
430428
#else
431429
vendor = "OPENBLAS";
432430
#endif

ggml-tune.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ struct ggml_mulmat_tune_profile_time {
7171
int total_time;
7272
};
7373

74-
void ggml_task_conf_format_name(const struct ggml_task_profile *profile,
75-
char *buf, int buf_len);
76-
7774
int ggml_mulmat_tune_validate(struct ggml_mulmat_tune *tune,
7875
const char *model_name,
7976
/*enum ggml_type*/ int type);

tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ llama_add_test(test-sampling.cpp)
1212
llama_add_test(test-tokenizer-0.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../models/ggml-vocab.bin)
1313
# llama_add_test(test-grad0.c) # SLOW
1414
# llama_add_test(test-opt.c) # SLOW
15-
# llama_add_test(test-mulmat-tune.c)
15+
llama_add_test(test-mulmat-tune.c)

0 commit comments

Comments
 (0)