-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error checking to CUDA version of getNeighborPairs (#80)
* Add error checking to CUDA version of getNeighborPairs * Add a new bool optional parameter to getNeighborPairs, setting it to true will force the function to synchronize and throw an exception if some error was found, so it can be catched. The default will throw the error asynchronously, which will crash the program. In both cases a meaningful message is printed. * Remove unnecessarily static variable * Change the error handling of getNeighborPairs. - Add a new optional flag, sync_exceptions on top of the current check_errors. - Three behaviors are possible: 1. Default (both false). Operation is CUDA-graph compatible and an uncatchable exception is thrown in case of number of pairs being too high. 2. check_errors=True. Operation is CUDA-graph compatible. No exception is thrown and the number of found pairs is returned, which can be higher than max_number_pairs. 3. check_errors=False and sync_exceptions=True. Operation is NOT CUDA-graph compatible. The operation synchronizes to check for errors and throws a catchable exception if necessary. * Make getNeighborPairs CUDA-graph compatible, add test for it * Remove incorrect comment * Change not by ! * Move all torch.ops.load calls to the __init__.py scripts * Change how the location of libNNPOpsPyTorch.so is found at __init__ scripts * Remove spurious lines in CMakeLists.txt * Update again how libNNPOpsPyTorch.so is found in __init__.py * Remove redundant torch load * Skip CUDA graph test if no GPU is available * Remove incorrect path in __init__ * Use relative path to load NNPOps library in __init__.py * Copy test scripts to build directory, run them there * Remove unnecessary import * Some fixes for CUDA graph support in getNEighborPairs * Reverse logic for check_errors in getNeighborPairs.py * Reverse check_errors flag in the rest of the getNeighborPair-related files * Clarify documentation on the error raised by getNeighborPairs * Always return the number of found pairs in getNeighborPairs * Revert "Always return the number of found pairs in getNeighborPairs" This reverts commit c36243b. * Fix check_error interpretation in getNeighborPairs.py * Add return number of pairs functionality again This reverts commit 8da1c5d. * Update tests with new getNeighborPairs interface * Fix type decorator preventing jit.script from working on getNeighborPairs * Remove sync_exceptions flag, simplifying the behavior and relation with CUDA graphs. If check_errors=False (the default) getNeighborPairs does not check for errors and is compatible with graphs. If check_errors=True, the function raises if necessary but it is incompatible with graphs * Remove unused function * Remove unnecessary synchronization in test * Clarify documentation of check_errors * Clarify documentation of number_found_pairs * Clarify documentation of CUDA graph functionality * Remove obsolete comment * Fix formatting * Fix formatting * Update documentation * Change the (misleading) num_pairs variable name to max_num_pairs. Enforce that the found number of pairs is less than num_pairs * Add test that checks if the max_num_neighbors per particle is enforced. Right now this does not pass, since the function allows that an atom has more neighbors than max_num_neighbors as long as num_found_pairs<num_atoms*max_num_neighbors * Change the meaning and name from max_num_neighbors (maximum number of neighbors per particle) to max_num_pairs (maximum number of total pairs). * Fix typo in comment
- Loading branch information
1 parent
c5b12ba
commit b27ec97
Showing
5 changed files
with
194 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.