Skip to content

Commit 0921736

Browse files
committed
Latest commits, updated Makefile and Readme
1 parent 6f2a4b1 commit 0921736

File tree

7 files changed

+145617
-145607
lines changed

7 files changed

+145617
-145607
lines changed

Makefile

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -423,79 +423,87 @@ GGML_F = GGML
423423

424424
#####################################
425425
################################ GGUF
426+
PREFIX = t
427+
426428
OBJS_GGUF = \
427-
$(TMP)t_ggml.o \
428-
$(TMP)t_ggml-alloc.o \
429-
$(TMP)t_ggml-backend.o \
430-
$(TMP)t_ggml-quants.o \
431-
$(TMP)t_ggml-aarch64.o \
432-
$(TMP)t_llama.o \
433-
$(TMP)t_llama-vocab.o \
434-
$(TMP)t_llama-grammar.o \
435-
$(TMP)t_llama-sampling.o \
436-
$(TMP)t_llama-addon.o \
437-
$(TMP)t_sampling.o \
438-
$(TMP)t_common.o \
439-
$(TMP)t_grammar-parser.o \
440-
$(TMP)t_unicode.o \
441-
$(TMP)t_unicode-data.o \
442-
$(TMP)t_sgemm.o
429+
$(TMP)$(PREFIX)_ggml.o \
430+
$(TMP)$(PREFIX)_ggml-alloc.o \
431+
$(TMP)$(PREFIX)_ggml-backend.o \
432+
$(TMP)$(PREFIX)_ggml-quants.o \
433+
$(TMP)$(PREFIX)_ggml-aarch64.o \
434+
$(TMP)$(PREFIX)_llama.o \
435+
$(TMP)$(PREFIX)_llama-vocab.o \
436+
$(TMP)$(PREFIX)_llama-grammar.o \
437+
$(TMP)$(PREFIX)_llama-sampling.o \
438+
$(TMP)$(PREFIX)_llama-addon.o \
439+
$(TMP)$(PREFIX)_sampling.o \
440+
$(TMP)$(PREFIX)_common.o \
441+
$(TMP)$(PREFIX)_grammar-parser.o \
442+
$(TMP)$(PREFIX)_unicode.o \
443+
$(TMP)$(PREFIX)_unicode-data.o \
444+
$(TMP)$(PREFIX)_sgemm.o
443445

444446
ifdef OPENBLAS64
445447
CXXFLAGS += -DGGML_USE_BLAS $(shell pkg-config --cflags-only-I openblas64)
448+
CXXFLAGS_UI += -DGGML_USE_BLAS $(shell pkg-config --cflags-only-I openblas64)
446449
CFLAGS += $(shell pkg-config --cflags-only-other openblas64)
447450
LDFLAGS += $(shell pkg-config --libs openblas64) --static
448-
OBJS_GGUF += $(TMP)t_ggml-blas.o
451+
OBJS_GGUF += $(TMP)$(PREFIX)_ggml-blas.o
452+
override EXE = Llama_Chat_gguf$(ARCH_NAME)$(RENDERER)_OPENBLAS
453+
override PREFIX = obt
449454
endif # GGML_OPENBLAS
450455

451456
ifdef OPENBLAS
452457
CXXFLAGS += -DGGML_USE_BLAS $(shell pkg-config --cflags-only-I openblas)
458+
CXXFLAGS_UI += -DGGML_USE_BLAS $(shell pkg-config --cflags-only-I openblas)
453459
CFLAGS += $(shell pkg-config --cflags-only-other openblas)
454460
LDFLAGS += $(shell pkg-config --libs openblas) --static
455-
OBJS_GGUF += $(TMP)t_ggml-blas.o
461+
OBJS_GGUF += $(TMP)$(PREFIX)_ggml-blas.o
462+
override EXE = Llama_Chat_gguf$(ARCH_NAME)$(RENDERER)_OPENBLAS
463+
override PREFIX = obt
456464
endif # GGML_OPENBLAS
457465

458466
$(TMP)tinyfiledialogs/tinyfiledialogs.o: tinyfiledialogs/tinyfiledialogs.c tinyfiledialogs/tinyfiledialogs.h
459467
$(CC) $(CFLAGS) -c $< -o $@
460468

461-
$(TMP)t_ggml.o: $(ggmlsrc_f)/ggml.c $(ggmlsrc_f)/ggml.h
469+
$(TMP)$(PREFIX)_ggml.o: $(ggmlsrc_f)/ggml.c $(ggmlsrc_f)/ggml.h
462470
$(CC) $(CFLAGS) -c $< -o $@
463471

464-
$(TMP)t_ggml-alloc.o: $(ggmlsrc_f)/ggml-alloc.c $(ggmlsrc_f)/ggml.h $(ggmlsrc_f)/ggml-alloc.h
472+
$(TMP)$(PREFIX)_ggml-alloc.o: $(ggmlsrc_f)/ggml-alloc.c $(ggmlsrc_f)/ggml.h $(ggmlsrc_f)/ggml-alloc.h
465473
$(CC) $(CFLAGS) -c $< -o $@
466474

467-
$(TMP)t_ggml-backend.o: $(ggmlsrc_f)/ggml-backend.c $(ggmlsrc_f)/ggml.h $(ggmlsrc_f)/ggml-backend.h
475+
$(TMP)$(PREFIX)_ggml-backend.o: $(ggmlsrc_f)/ggml-backend.c $(ggmlsrc_f)/ggml.h $(ggmlsrc_f)/ggml-backend.h
468476
$(CC) $(CFLAGS) -c $< -o $@
469477

470-
$(TMP)t_ggml-quants.o: \
478+
$(TMP)$(PREFIX)_ggml-quants.o: \
471479
$(ggmlsrc_f)/ggml-quants.c \
472480
$(ggmlsrc_f)/ggml.h \
473481
$(ggmlsrc_f)/ggml-quants.h \
474482
$(ggmlsrc_f)/ggml-common.h
475483
$(CC) $(CFLAGS) -c $< -o $@
476484

477-
$(TMP)t_ggml-aarch64.o: \
485+
$(TMP)$(PREFIX)_ggml-aarch64.o: \
478486
$(ggmlsrc_f)/ggml-aarch64.c \
479487
$(ggmlsrc_f)/ggml.h \
480488
$(ggmlsrc_f)/ggml-aarch64.h \
481489
$(ggmlsrc_f)/ggml-common.h
482490
$(CC) $(CFLAGS) -c $< -o $@
483491

484-
$(TMP)t_ggml-blas.o: \
492+
$(TMP)$(PREFIX)_ggml-blas.o: \
485493
$(ggmlsrc_f)/ggml-blas.cpp \
486494
$(ggmlsrc_f)/ggml-blas.h
487495
$(CXX) $(CXXFLAGS) -c $< -o $@
488496

489-
$(TMP)t_sgemm.o: $(llamacpp_f)/sgemm.cpp $(llamacpp_f)/sgemm.h $(ggmlsrc_f)/ggml.h
497+
$(TMP)$(PREFIX)_sgemm.o: $(llamacpp_f)/sgemm.cpp $(llamacpp_f)/sgemm.h $(ggmlsrc_f)/ggml.h
490498
$(CXX) $(CXXFLAGS) -c $< -o $@
491499

492-
$(TMP)t_unicode.o: $(llamacpp_f)/unicode.cpp $(llamacpp_f)/unicode.h
500+
$(TMP)$(PREFIX)_unicode.o: $(llamacpp_f)/unicode.cpp $(llamacpp_f)/unicode.h
493501
$(CXX) $(CXXFLAGS) -c $< -o $@
494502

495-
$(TMP)t_unicode-data.o: $(llamacpp_f)/unicode-data.cpp $(llamacpp_f)/unicode-data.h
503+
$(TMP)$(PREFIX)_unicode-data.o: $(llamacpp_f)/unicode-data.cpp $(llamacpp_f)/unicode-data.h
496504
$(CXX) $(CXXFLAGS) -c $< -o $@
497505

498-
$(TMP)t_llama.o: $(llamacpp_f)/llama.cpp \
506+
$(TMP)$(PREFIX)_llama.o: $(llamacpp_f)/llama.cpp \
499507
$(llamacpp_f)/llama-impl.h \
500508
$(llamacpp_f)/llama-vocab.h \
501509
$(llamacpp_f)/llama-grammar.h \
@@ -507,14 +515,14 @@ $(TMP)t_llama.o: $(llamacpp_f)/llama.cpp \
507515
$(ggmlsrc_f)/ggml-backend.h
508516
$(CXX) $(CXXFLAGS) -c $< -o $@
509517

510-
$(TMP)t_llama-vocab.o: \
518+
$(TMP)$(PREFIX)_llama-vocab.o: \
511519
$(llamacpp_f)/llama-vocab.cpp \
512520
$(llamacpp_f)/llama-vocab.h \
513521
$(llamacpp_f)/llama-impl.h \
514522
$(llamacpp_f)/llama.h
515523
$(CXX) $(CXXFLAGS) -c $< -o $@
516524

517-
$(TMP)t_llama-grammar.o: \
525+
$(TMP)$(PREFIX)_llama-grammar.o: \
518526
$(llamacpp_f)/llama-grammar.cpp \
519527
$(llamacpp_f)/llama-grammar.h \
520528
$(llamacpp_f)/llama-impl.h \
@@ -523,26 +531,26 @@ $(TMP)t_llama-grammar.o: \
523531
$(llamacpp_f)/llama.h
524532
$(CXX) $(CXXFLAGS) -c $< -o $@
525533

526-
$(TMP)t_llama-sampling.o: \
534+
$(TMP)$(PREFIX)_llama-sampling.o: \
527535
$(llamacpp_f)/llama-sampling.cpp \
528536
$(llamacpp_f)/llama-sampling.h \
529537
$(llamacpp_f)/llama-impl.h \
530538
$(llamacpp_f)/llama.h
531539
$(CXX) $(CXXFLAGS) -c $< -o $@
532540

533541
COMMON_H_DEPS = $(common_f)/common.h $(common_f)/sampling.h $(common_f)/llama-addon.h $(llamacpp_f)/llama.h
534-
COMMON_DEPS = $(TMP)common.o $(TMP)sampling.o $(TMP)grammar-parser.o
542+
COMMON_DEPS = $(TMP)$(PREFIX)_common.o $(TMP)$(PREFIX)_sampling.o $(TMP)$(PREFIX)_grammar-parser.o
535543

536-
$(TMP)t_common.o: $(common_f)/common.cpp $(COMMON_H_DEPS)
544+
$(TMP)$(PREFIX)_common.o: $(common_f)/common.cpp $(COMMON_H_DEPS)
537545
$(CXX) $(CXXFLAGS) -c $< -o $@
538546

539-
$(TMP)t_sampling.o: $(common_f)/sampling.cpp $(COMMON_H_DEPS)
547+
$(TMP)$(PREFIX)_sampling.o: $(common_f)/sampling.cpp $(COMMON_H_DEPS)
540548
$(CXX) $(CXXFLAGS) -c $< -o $@
541549

542-
$(TMP)t_llama-addon.o: $(common_f)/llama-addon.cpp $(COMMON_H_DEPS)
550+
$(TMP)$(PREFIX)_llama-addon.o: $(common_f)/llama-addon.cpp $(COMMON_H_DEPS)
543551
$(CXX) $(CXXFLAGS) -c $< -o $@
544552

545-
$(TMP)t_grammar-parser.o: $(common_f)/grammar-parser.cpp $(common_f)/grammar-parser.h
553+
$(TMP)$(PREFIX)_grammar-parser.o: $(common_f)/grammar-parser.cpp $(common_f)/grammar-parser.h
546554
$(CXX) $(CXXFLAGS) -c $< -o $@
547555

548556
# test CLBLAST

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,23 @@ Code:
4545
Libraries:
4646
* Vulkan SDK (installer is preferred) https://vulkan.lunarg.com/#new_tab
4747
* SDL2 https://github.com/libsdl-org/SDL
48+
* If OpenBLAS is needed: use [releases](https://github.com/OpenMathLib/OpenBLAS/releases) and [Clblast](https://github.com/CNugteren/CLBlast).
4849
* If CLBLAST is needed: use releases of [OpenCL SDK](https://github.com/KhronosGroup/OpenCL-SDK) and [Clblast](https://github.com/CNugteren/CLBlast).
4950

5051
### Building on Windows
5152

52-
* Download this repo or `git clone` it
53-
* Use w64devkit https://github.com/skeeto/w64devkit/releases
54-
* Install all prerequisite libraries according to w64devkit installation (which is, in most cases, copying `lib` and `include` folders into `w64devkit/x86_64-w64-mingw32`)
55-
* Download and copy all prerequisite code according to Makefile
56-
* Launch w64devkit.exe and navigate to the project folder
57-
* `make chat` for CPU-only
58-
* `make chat_cl` for Clblast build
59-
* `make chat_vk` for Vulkan build
60-
* `make chatTest`, `make chatTest_cl` and `make chatTest_vk` for building the debugging program
61-
* for CPU-only builds use `OPENBLAS64=1` to enable OpenBLAS (helps with prompt processing)
62-
* if your GPU/iGPU don't support Vulkan, compile with SDL2=1
53+
1. Use `git clone https://github.com/MaggotHATE/Llama_chat`, or download this repo and unpack it
54+
2. Download w64devkit https://github.com/skeeto/w64devkit/releases and unpack it to a desireable folder
55+
3. Install all prerequisite libraries according to w64devkit installation: in most cases it means copying `lib` and `include` folders into `w64devkit/x86_64-w64-mingw32`
56+
* for example, OpenBLAS has `bin`, `include` and `lib` folders - unpack them into `w64devkit/x86_64-w64-mingw32`
57+
4. Download and copy all prerequisite code: specific version of [imgui](https://github.com/ocornut/imgui/tree/f6836ff37fd361010829621f610837686aa00944) and [tinyfiledialogs](https://sourceforge.net/projects/tinyfiledialogs/)
58+
5. Launch w64devkit.exe and navigate to the project folder, then build:
59+
* `make chat` for CPU-only UI version
60+
* `make chat_cl` for Clblast UI version
61+
* `make chat_vk` for Vulkan UI version
62+
6. `make chatTest`, `make chatTest_cl` and `make chatTest_vk` for building the debugging program
63+
* for CPU-only builds add `OPENBLAS64=1` to compile with OpenBLAS (helps with prompt processing)
64+
* if your GPU/iGPU don't support Vulkan, compile UI with SDL2=1
6365
* if you need Windows console for debugging, compile with CONW=1
6466
* see more in makefile
6567

0 commit comments

Comments
 (0)