1pub mod context;
7pub mod dense;
8pub mod eigen;
9pub mod error;
10pub mod irs;
11pub mod layout;
12pub mod params;
13pub mod svd;
14pub mod types;
15
16pub(crate) mod utility;
17
18#[cfg(feature = "testing")]
19pub mod testing;
20
21use singe_core::LibraryVersion;
22use singe_cuda::types::LibraryProperty;
23use singe_cusolver_sys as sys;
24
25use crate::error::Result;
26
27pub fn version() -> Result<LibraryVersion> {
33 let mut version = 0;
34 unsafe {
35 try_ffi!(sys::cusolverGetVersion(&raw mut version))?;
36 }
37 let version = version as u64;
38 Ok(LibraryVersion::new(
39 version / 10000,
40 (version % 10000) / 100,
41 version % 100,
42 ))
43}
44
45pub fn library_property(property: LibraryProperty) -> Result<i32> {
52 let mut value = 0;
53 unsafe {
54 try_ffi!(sys::cusolverGetProperty(property.into(), &raw mut value))?;
55 }
56 Ok(value)
57}
58
59#[cfg(all(test, feature = "testing"))]
60mod tests {
61 use super::*;
62 use crate::testing::setup_context_if_available;
63
64 #[test]
65 fn it_works() -> Result<()> {
66 let Some(_ctx) = setup_context_if_available()? else {
67 return Ok(());
68 };
69 let version = version()?;
70 println!("cuSOLVER version: {version}");
71 assert_ne!(version, 0);
72 assert_ne!(library_property(LibraryProperty::Major)?, 0);
73 Ok(())
74 }
75}