open_blast
Some checks failed
Build Actions Cache / ubuntu-24-vulkan-cache (push) Has been cancelled
Build Actions Cache / ubuntu-24-openvino-cache (push) Has been cancelled
Build Actions Cache / windows-2022-openvino-cache (push) Has been cancelled
Build Actions Cache / windows-2022-rocm-cache (push) Has been cancelled
Close inactive issues / close-issues (push) Has been cancelled
Publish Docker image / Create and push git tag (push) Has been cancelled
Publish Docker image / Build UI (push) Has been cancelled
Publish Docker image / Prepare Docker matrices (push) Has been cancelled
Publish Docker image / Push Docker image to Docker Registry (push) Has been cancelled
Publish Docker image / Create shared tags from digests (push) Has been cancelled
Update Winget Package / Update Winget Package (push) Has been cancelled
Some checks failed
Build Actions Cache / ubuntu-24-vulkan-cache (push) Has been cancelled
Build Actions Cache / ubuntu-24-openvino-cache (push) Has been cancelled
Build Actions Cache / windows-2022-openvino-cache (push) Has been cancelled
Build Actions Cache / windows-2022-rocm-cache (push) Has been cancelled
Close inactive issues / close-issues (push) Has been cancelled
Publish Docker image / Create and push git tag (push) Has been cancelled
Publish Docker image / Build UI (push) Has been cancelled
Publish Docker image / Prepare Docker matrices (push) Has been cancelled
Publish Docker image / Push Docker image to Docker Registry (push) Has been cancelled
Publish Docker image / Create shared tags from digests (push) Has been cancelled
Update Winget Package / Update Winget Package (push) Has been cancelled
This commit is contained in:
@@ -18,6 +18,21 @@
|
|||||||
# include <cblas.h>
|
# include <cblas.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# ifndef NOMINMAX
|
||||||
|
# define NOMINMAX
|
||||||
|
# endif
|
||||||
|
# include <windows.h>
|
||||||
|
#else
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
# include <sys/sysctl.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
struct ggml_backend_blas_context {
|
struct ggml_backend_blas_context {
|
||||||
int n_threads = GGML_DEFAULT_N_THREADS;
|
int n_threads = GGML_DEFAULT_N_THREADS;
|
||||||
std::unique_ptr<char[]> work_data;
|
std::unique_ptr<char[]> work_data;
|
||||||
@@ -343,9 +358,22 @@ static const char * ggml_backend_blas_device_get_description(ggml_backend_dev_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ggml_backend_blas_device_get_memory(ggml_backend_dev_t dev, size_t * free, size_t * total) {
|
static void ggml_backend_blas_device_get_memory(ggml_backend_dev_t dev, size_t * free, size_t * total) {
|
||||||
// no memory to report
|
#ifdef _WIN32
|
||||||
*free = 0;
|
MEMORYSTATUSEX status;
|
||||||
*total = 0;
|
status.dwLength = sizeof(status);
|
||||||
|
GlobalMemoryStatusEx(&status);
|
||||||
|
*total = status.ullTotalPhys;
|
||||||
|
*free = status.ullAvailPhys;
|
||||||
|
#else
|
||||||
|
long pages = sysconf(_SC_PHYS_PAGES);
|
||||||
|
long page_size = sysconf(_SC_PAGE_SIZE);
|
||||||
|
*total = pages * page_size;
|
||||||
|
|
||||||
|
// "free" system memory is ill-defined, for practical purposes assume that all of it is free:
|
||||||
|
*free = *total;
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GGML_UNUSED(dev);
|
GGML_UNUSED(dev);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user