Skip to content

Commit

Permalink
[pytorch] Allows to exclude certain DLL from pytorch directory (#3043)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu authored Mar 26, 2024
1 parent fa28fbe commit 091a41c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ private static void loadLibTorch(LibTorch libTorch) {
}
}
}
String libExclusion = Utils.getEnvOrSystemProperty("PYTORCH_LIBRARY_EXCLUSION", "");
Set<String> exclusion = new HashSet<>(Arrays.asList(libExclusion.split(",")));
boolean isCuda = libTorch.flavor.contains("cu");
List<String> deferred =
Arrays.asList(
Expand All @@ -137,7 +139,8 @@ private static void loadLibTorch(LibTorch libTorch) {
paths.filter(
path -> {
String name = path.getFileName().toString();
if (!LIB_PATTERN.matcher(name).matches()) {
if (!LIB_PATTERN.matcher(name).matches()
|| exclusion.contains(name)) {
return false;
} else if (!isCuda
&& name.contains("nvrtc")
Expand Down

0 comments on commit 091a41c

Please sign in to comment.