has_cuda/vulkan/metal

This commit is contained in:
Hanh 2022-08-19 12:07:55 +08:00
parent 3c0ae90eb4
commit d4fc07b2e7
5 changed files with 37 additions and 2 deletions

View File

@ -13,6 +13,14 @@ typedef void *DartPostCObjectFnType;
#define QR_DATA_SIZE 256
#define N 200000
#define N 200000
#define DATA_SIZE 416
#define THREADS_PER_BLOCK 64
void dummy_export(void);
void dart_post_cobject(DartPostCObjectFnType ptr);
@ -132,3 +140,7 @@ uintptr_t get_downloaded_size(void);
uintptr_t get_trial_decryptions_count(void);
bool has_cuda(void);
bool has_vulkan(void);
bool has_metal(void);

View File

@ -659,3 +659,13 @@ pub unsafe extern "C" fn get_trial_decryptions_count() -> usize {
pub unsafe extern "C" fn has_cuda() -> bool {
crate::has_cuda()
}
#[no_mangle]
pub unsafe extern "C" fn has_vulkan() -> bool {
crate::has_vulkan()
}
#[no_mangle]
pub unsafe extern "C" fn has_metal() -> bool {
crate::has_metal()
}

View File

@ -193,6 +193,7 @@ impl CudaProcessor {
impl GPUProcessor for CudaProcessor {
fn decrypt_account(&mut self, ivk: &SaplingIvk) -> Result<()> {
if self.n == 0 { return Ok(()) }
let mut ivk_fr = ivk.0;
ivk_fr = ivk_fr.double(); // multiply by cofactor
ivk_fr = ivk_fr.double();

View File

@ -108,3 +108,11 @@ pub fn has_cuda() -> bool {
pub fn has_cuda() -> bool {
false
}
pub fn has_vulkan() -> bool {
cfg!(feature = "vulkan")
}
pub fn has_metal() -> bool {
cfg!(feature = "apple_metal")
}

View File

@ -321,13 +321,17 @@ pub async fn sync_async(
Ok::<_, anyhow::Error>(())
});
let res = tokio::try_join!(downloader, processor);
let res = tokio::try_join!(downloader, decryptor, processor);
match res {
Ok((d, p)) => {
Ok((d, dc, p)) => {
if let Err(err) = d {
log::info!("Downloader error = {}", err);
return Err(err);
}
if let Err(err) = dc {
log::info!("Decryptor error = {}", err);
return Err(err);
}
if let Err(err) = p {
log::info!("Processor error = {}", err);
return Err(err);