-
Notifications
You must be signed in to change notification settings - Fork 978
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new omp_set_nested_linter for C (#6347)
* Add a linter for calls to omp_set_num_threads * simplify, comment * refactor * new omp_set_nested_linter * #define in myomp.h is not needed since macro is not used
- Loading branch information
1 parent
26c2c08
commit caacbbd
Showing
3 changed files
with
11 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Ensure no calls to omp_set_nested() as | ||
# i) it's hard to fully honor OMP_THREAD_LIMIT as required by CRAN, and | ||
# ii) a simpler non-nested approach is always preferable if possible, as has been the case so far | ||
omp_set_nested_linter = function(c_obj) { | ||
idx = grep("omp_set_nested", c_obj$lines, fixed=TRUE) | ||
if (!length(idx)) return() | ||
stop(sprintf( | ||
"In %s, found omp_set_nested() usage, please reconsider:\n%s", | ||
c_obj$path, paste0(" ", format(idx), ":", c_obj$lines[idx], collapse = "\n") | ||
)) | ||
} |
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