Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SkillfulElectro authored Aug 30, 2024
1 parent 26d9ffd commit 6a4582f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "EMCompute"
version = "2.0.0"
version = "2.1.0"
edition = "2021"
authors = ["ElectroMutex"]
description = "fast , simple and cross-platform parallel computing library"
Expand All @@ -14,7 +14,7 @@ categories = ["concurrency"]

[lib]
name = "EMCompute"
crate-type = ["cdylib"]
crate-type = ["cdylib" , "lib"]

[dependencies]
wgpu = "22"
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,9 @@ int main() {
```
- check out example https://github.com/SkillfulElectro/EMCompute/tree/main/examples and Goodluck :)

## NEWS
- since version 2.0.0 the API does caching to prevent allocating GPU res and improve performance
- since version 2.1.0 you can deallocate API caches by calling free_compute_cache() function to deallocate the caches

## Contribution
- if you find any problem or bug , ill be happy with your pull req or issue report
10 changes: 8 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct GPUCollection {
device : Arc<wgpu::Device> ,
queue : Arc<wgpu::Queue> ,
}
// Caching GPU res
// hashing GPU res
static mut GPU_RES_KEEPER : Option<Arc<Mutex<HashMap<GPUComputingConfig , GPUCollection>>>> = None;


Expand Down Expand Up @@ -570,8 +570,14 @@ pub extern "C" fn compute(kernel : CKernel , data_for_gpu : *mut GroupOfBinders
}
}


#[no_mangle]
/// experimental
/// since version 2.0.0 api does
/// caching for gpu resources on the memory .
/// the api does deallocates the caches
/// automatically , but in some cases
/// you might want to do it manually
/// so just call this free_compute_cache();
pub extern "C" fn free_compute_cache(){
unsafe {
GPU_RES_KEEPER = None;
Expand Down

0 comments on commit 6a4582f

Please sign in to comment.