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 Ok(LibraryVersion::from(version))
38}
39
40pub fn library_property(property: LibraryProperty) -> Result<i32> {
47 let mut value = 0;
48 unsafe {
49 try_ffi!(sys::cusolverGetProperty(property.into(), &raw mut value))?;
50 }
51 Ok(value)
52}
53
54#[cfg(all(test, feature = "testing"))]
55mod tests {
56 use super::*;
57 use crate::testing::setup_context_if_available;
58
59 #[test]
60 fn it_works() -> Result<()> {
61 let Some(_ctx) = setup_context_if_available()? else {
62 return Ok(());
63 };
64 let version = version()?;
65 println!("cuSOLVER version: {version}");
66 assert_ne!(version, 0);
67 assert_ne!(library_property(LibraryProperty::Major)?, 0);
68 Ok(())
69 }
70}