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

Support -fno-exceptions #42

Open
alecjohnson opened this issue Aug 1, 2013 · 0 comments
Open

Support -fno-exceptions #42

alecjohnson opened this issue Aug 1, 2013 · 0 comments

Comments

@alecjohnson
Copy link
Contributor

I want to check in code to eliminate the use of exceptions in iPic3D.

Allowing exceptions has performance penalties. In particular, while developing an array class for iPic3D, I observed that looping through array elements took three times as long if the body of the destructor of the array class was nonempty. This performance penalty disappeared when I compiled with the -fno-exceptions flag.

I see no reason to retain exception handling in iPic3D. This is not an event-driven application. All current use of exceptions is used to generate error messages, which can be handled adequately with simple calls to eprintf(). Therefore, I am going through the code and replacing each throwing of an exception such as

  PSK::OutputException e("make_dataset fails for " + tag, "HDF5OutputAdaptor::write(double* array)");
  throw e;

with printing of an error message such as

  eprintf("make_dataset fails for %s", tag.c_str());

Note that the eprintf() macro automatically prints file, line number, and method name, so there is no need to add any of that information to the call to eprintf().

In my initial implementation of this change I simply comment out all occurences of try and all catch blocks and all calls to throw, replacing each call to throw with a call to eprintf. I leave it for later to decide whether to completely eliminate the Exception and OutputException classes in the PSK namespace or whether for some reason to revert to supporting the possibility of exceptions via pre-processor branching directives.

alecjohnson added a commit to alecjohnson/iPic3D that referenced this issue Aug 1, 2013
murci3lag0 added a commit that referenced this issue Jul 28, 2014
From issue #42: it is unnecessary to recompile the code when we change the processor topology. The number of subdomains in each direction is how given iniside the input file.

The modifications are based on the code implemented in:
alecjohnson/iPic3D@8b81a53
alecjohnson/iPic3D@2ac8e76
alecjohnson/iPic3D@51fa54d

The GEM.inp file has been modified to include the new input options.

From issue #50: CollectiveIO is an abstract base class that is not really used. CollectiveIO was eliminated. All calls to CollectiveIO are now set to Collective.

The Makefile has been updated.
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

No branches or pull requests

1 participant