Skip to content

Commit

Permalink
avoid huge CUDA memset - faster boot
Browse files Browse the repository at this point in the history
this is a hotfix for huge load times in some devices
  • Loading branch information
VictorTaelin committed May 23, 2024
1 parent 656c881 commit 38fc2f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hvm"
version = "2.0.14"
version = "2.0.15"
edition = "2021"
build = "build.rs"
description = "A massively parallel, optimal functional runtime in Rust."
Expand Down
16 changes: 15 additions & 1 deletion src/hvm.cu
Original file line number Diff line number Diff line change
Expand Up @@ -1685,10 +1685,24 @@ __global__ void evaluator(GNet* gnet) {
// GNet Host Functions
// -------------------

// Initializes the GNet
__global__ void initialize(GNet* gnet) {
gnet->node_put[GID()] = 0;
gnet->vars_put[GID()] = 0;
gnet->rbag_pos[GID()] = 0;
for (u32 i = 0; i < RLEN; ++i) {
gnet->rbag_buf_A[G_RBAG_LEN / TPG * GID()] = 0;
}
for (u32 i = 0; i < RLEN; ++i) {
gnet->rbag_buf_B[G_RBAG_LEN / TPG * GID()] = 0;
}
}

GNet* gnet_create() {
GNet *gnet;
cudaMalloc((void**)&gnet, sizeof(GNet));
cudaMemset(gnet, 0, sizeof(GNet));
initialize<<<BPG, TPB>>>(gnet);
//cudaMemset(gnet, 0, sizeof(GNet));
return gnet;
}

Expand Down

0 comments on commit 38fc2f1

Please sign in to comment.