-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler): [GPU backend] add sanity checks when the emitGPUOps op…
…tion is selected to ensure that the compiler/runtime have GPU capability and that at least one device is available to run on.
- Loading branch information
1 parent
f299adf
commit 7fb35ca
Showing
5 changed files
with
80 additions
and
24 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
compilers/concrete-compiler/compiler/include/concretelang/Runtime/GPUDFG.hpp
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,29 @@ | ||
// Part of the Concrete Compiler Project, under the BSD3 License with Zama | ||
// Exceptions. See | ||
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt | ||
// for license information. | ||
|
||
#ifndef CONCRETELANG_GPUDFG_HPP | ||
#define CONCRETELANG_GPUDFG_HPP | ||
|
||
#ifdef CONCRETELANG_CUDA_SUPPORT | ||
#include "bootstrap.h" | ||
#include "device.h" | ||
#include "keyswitch.h" | ||
#include "linear_algebra.h" | ||
|
||
namespace mlir { | ||
namespace concretelang { | ||
namespace dfr { | ||
|
||
bool check_cuda_device_available() { | ||
int num; | ||
if (cudaGetDeviceCount(&num) != cudaSuccess) | ||
return false; | ||
return num > 0; | ||
} | ||
} // namespace dfr | ||
} // namespace concretelang | ||
} // namespace mlir | ||
#endif | ||
#endif |
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
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