Skip to content

Conversation

amirbous
Copy link

@amirbous amirbous commented Oct 28, 2024

#example

Further work on code provided by @pratikvn going along with progress for using ginkgo in electrostatic

Structure and changes - all changes are done under example/electrostatic-abb:
Added new utils.hpp file to include user defined methods: read input from matrix file, read config file .... .
And moved some of the already existing functions to it
added readme.md for electrstatic specific usage

Purpose
Added Support for binary matrix files: added reader
Added config file (electrto.config) parser , to read parameters for Ginkgo configuration
Ginkgo configuration parameters are set in electro.config. More in the readme page for the electrostatic example

!! Warning !!:
Still uncertain about double and single precision as output files seem to be double precision in ascii format and single precision in binary format. For now when reading binary, reading as float and casting to double.

@pratikvn
Copy link
Member

Thanks @amirbous! I think the explicit cast to double should not be necessary, but shouldn't hurt. The matrix_data object is templated and should implicitly cast to its value_type.

So, you should be able to automatically run different solvers for both float and double by changing the using ValueType = ... in the electrostatic_abb.cpp file and compiling it again.

@upsj
Copy link
Member

upsj commented Oct 28, 2024

@amirbous What you describe with respect to gko::write sounds like it might be a bug - can you confirm that the output format changes based only on the value type?

@pratikvn
Copy link
Member

@upsj , I think he is not using gko::write, but using the write functionality in the casopt library.

@amirbous
Copy link
Author

@upsj, @pratikvn Thank you for the check.
The input files I am using are generated externally from another fortran script, seperate from ginkgo, and are using different precision based on the format. I made sure to note it down, so whenever other files are being used.
I will proceed as described by @pratikvn where the user is aware of the datatype being used, and can speicify it in the ValueType.

@amirbous
Copy link
Author

. To reissue

@amirbous amirbous closed this Oct 28, 2024
@amirbous amirbous reopened this Oct 28, 2024
@amirbous amirbous marked this pull request as draft October 28, 2024 12:38
@amirbous amirbous marked this pull request as ready for review November 5, 2024 08:56
Copy link
Member

@pratikvn pratikvn left a comment

Choose a reason for hiding this comment

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

This looks okay to me. If I can merge it, let me know.

// Warmup
for (int i = 0; i < 3; ++i) {
x_clone->copy_from(x.get());
solver->apply(b, x_clone);
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 reduce the warmup here in line 150 to 1 instead of 3 to speed things up.

…s zero vector"

This reverts commit 2e2bc08.

Reverted to preserve formatting, and fix initializing null vector
for initial guess
@amirbous
Copy link
Author

amirbous commented Nov 5, 2024

I guess it should be ready now

@pratikvn pratikvn merged commit 1aaa756 into ginkgo-project:electrostatic-runner Nov 5, 2024
3 checks passed
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.

3 participants