mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Compare commits
2 Commits
226a1d24e0
...
9bfc476d72
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bfc476d72 | ||
|
|
25e2356316 |
@@ -110,7 +110,7 @@ Hannun, Jagrit Digani, Angelos Katharopoulos, and Ronan Collobert. If you find
|
|||||||
MLX useful in your research and wish to cite it, please use the following
|
MLX useful in your research and wish to cite it, please use the following
|
||||||
BibTex entry:
|
BibTex entry:
|
||||||
|
|
||||||
```
|
```text
|
||||||
@software{mlx2023,
|
@software{mlx2023,
|
||||||
author = {Awni Hannun and Jagrit Digani and Angelos Katharopoulos and Ronan Collobert},
|
author = {Awni Hannun and Jagrit Digani and Angelos Katharopoulos and Ronan Collobert},
|
||||||
title = {{MLX}: Efficient and flexible machine learning on Apple silicon},
|
title = {{MLX}: Efficient and flexible machine learning on Apple silicon},
|
||||||
|
|||||||
@@ -30,15 +30,20 @@ SmallSizePool::SmallSizePool() {
|
|||||||
next_free_ = buffer_;
|
next_free_ = buffer_;
|
||||||
|
|
||||||
CHECK_CUDA_ERROR(cudaMallocManaged(&data_, small_pool_size));
|
CHECK_CUDA_ERROR(cudaMallocManaged(&data_, small_pool_size));
|
||||||
|
|
||||||
|
int device_count = 0;
|
||||||
|
CHECK_CUDA_ERROR(cudaGetDeviceCount(&device_count));
|
||||||
|
for (int i = 0; i < device_count; ++i) {
|
||||||
#if CUDART_VERSION >= 13000
|
#if CUDART_VERSION >= 13000
|
||||||
cudaMemLocation loc;
|
cudaMemLocation loc;
|
||||||
loc.type = cudaMemLocationTypeDevice;
|
loc.type = cudaMemLocationTypeDevice;
|
||||||
loc.id = 0;
|
loc.id = i;
|
||||||
#else
|
#else
|
||||||
int loc = 0;
|
int loc = i;
|
||||||
#endif // CUDART_VERSION >= 13000
|
#endif // CUDART_VERSION >= 13000
|
||||||
CHECK_CUDA_ERROR(
|
CHECK_CUDA_ERROR(
|
||||||
cudaMemAdvise(data_, small_pool_size, cudaMemAdviseSetReadMostly, loc));
|
cudaMemAdvise(data_, small_pool_size, cudaMemAdviseSetAccessedBy, loc));
|
||||||
|
}
|
||||||
|
|
||||||
auto curr = next_free_;
|
auto curr = next_free_;
|
||||||
for (size_t i = 1; i < num_blocks; ++i) {
|
for (size_t i = 1; i < num_blocks; ++i) {
|
||||||
|
|||||||
Reference in New Issue
Block a user