Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpGEMM bad_alloc Error #31

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

SpGEMM bad_alloc Error #31

wants to merge 7 commits into from

Conversation

Floruaaa666
Copy link

My SpGEMM approach uses the inner product (CSR*CSC = dense format) and I used a few input matrices from SS to test. For some of the input matrices, the program had an error saying:

terminate called after throwing an instance of 'thrust::system::detail::bad_alloc'
  what():  std::bad_alloc: cudaErrorMemoryAllocation: out of memory

The matrices with this error:

mac_econ_fwd500:
Dimensions: 207,500 x 207,500
Non-zeros: 1,273,389​1​.

pwtk:
Dimensions: 217,918 x 217,918
Non-zeros: 11,524,432​2​.

scircuit:
Dimensions: 170,998 x 170,998
Non-zeros: 958,936​3​.

shipsec1:
Dimensions: 140,874 x 140,874
Non-zeros: 3,568,176​4​.

Comment on lines +12 to +13
// Allocate memory for the host matrix data
h_C.m_data.resize(d_C.rows * d_C.cols);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can see it here, what is the size of d_C.rows * d_C.cols? I think this is $N^2$ problem, which can easily exceed the total device memory a GPU has available.

h_C.m_data.resize(d_C.rows * d_C.cols);

// Copy matrix data from device to host
cudaMemcpy(h_C.m_data.data(), d_C.m_data_ptr, sizeof(type_t) * d_C.rows * d_C.cols, cudaMemcpyDeviceToHost);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as above.

csc_t<index_t, offset_t, type_t> csc(mtx.load(parameters.filename));

// Output matrix.
matrix_t<type_t> C(csr.rows, csc.cols);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as above.

@neoblizz
Copy link
Member

@Floruaaa666 I see that this is a work in progress, let me know when you'd like me to review for merge after its been cleaned up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants