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

Fix matrix binary ops for large case where int4 isn't enough #222

Merged
merged 3 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Source/Fortran/PSMatrixModule.F90
Original file line number Diff line number Diff line change
Expand Up @@ -651,11 +651,12 @@ RECURSIVE SUBROUTINE ConstructMatrixFromBinary_ps(this, file_name, &

!! Compute Offset
local_triplets = total_values / this%process_grid%total_processors
local_offset = local_triplets * this%process_grid%global_rank
local_offset = INT(local_triplets, KIND=NTLONG) * &
& this%process_grid%global_rank
header_size = 3 * bytes_per_int + bytes_per_long
IF (this%process_grid%global_rank .EQ. &
& this%process_grid%total_processors - 1) THEN
local_triplets = INT(total_values) - INT(local_offset)
local_triplets = INT(total_values - local_offset)
END IF
local_offset = local_offset*(bytes_per_int*2 + bytes_per_data) + &
& header_size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
CALL MPI_Allgather(SIZE(merged_local_data%values), 1, MPINTINTEGER, &
& local_values_buffer, 1, MPINTINTEGER, &
& this%process_grid%within_slice_comm, ierr)
total_values = GetMatrixSize(this)

write_offset = 0
write_offset = write_offset + header_size
Expand Down Expand Up @@ -53,7 +54,6 @@
END IF
CALL MPI_File_write_at(mpi_file_handler, zero_offset, header_buffer, &
& 3, MPINTINTEGER, message_status, ierr)
total_values = SUM(local_values_buffer)
CALL MPI_File_write_at(mpi_file_handler, &
& zero_offset + bytes_per_int * 3, total_values, &
& 1, MPINTLONG, message_status, ierr)
Expand Down