mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-05-02 21:51:30 +00:00
fix kt-kernel installation issue (#1603)
* update README for kt-kernel for installation issues * update install.sh * update install.sh * update install.sh * update install.sh * update install.sh * update README * fix sudo issue * fix install issue * fix import issue * fix import issue * update install.sh * fix import issue * fix import issue * fix import issue * update README * update install * update install
This commit is contained in:
parent
26b86aa96b
commit
02801c3c4e
4 changed files with 332 additions and 32 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#include <numa.h>
|
||||
|
||||
#include <cstdio>
|
||||
#include <errno.h>
|
||||
|
||||
size_t MemoryRequest::total_size() {
|
||||
size_t total = 0;
|
||||
|
|
@ -53,12 +54,15 @@ void SharedMemBuffer::alloc(void* object, MemoryRequest requests) {
|
|||
if (buffer) {
|
||||
free(buffer);
|
||||
}
|
||||
buffer = std::aligned_alloc(64, total_size);
|
||||
if (!buffer) {
|
||||
printf("cannot aligned alloc %ld bytes\n", total_size);
|
||||
perror("aligned_alloc"); // errno == ENOMEM/EINVAL
|
||||
void* newbuf = nullptr;
|
||||
int rc = posix_memalign(&newbuf, 64, total_size);
|
||||
if (rc != 0 || !newbuf) {
|
||||
errno = rc; // posix_memalign returns error code instead of setting errno
|
||||
printf("cannot aligned alloc %zu bytes (align=%d)\n", (size_t)total_size, 64);
|
||||
perror("posix_memalign"); // ENOMEM/EINVAL
|
||||
exit(1);
|
||||
}
|
||||
buffer = newbuf;
|
||||
size = total_size;
|
||||
for (auto& req : object_requests) {
|
||||
req.update_base_ptr(buffer);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue