Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions build.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build_cpu": "ON",
"build_examples": "OFF",
"build_test": "OFF",
"build_graphics": "OFF",
"build_graphics": "OFF",

"glew_static": "OFF",
"freeimage_type": "DYNAMIC",
Expand All @@ -28,6 +28,8 @@
"glew_dir": "E:\\Libraries\\GLEW",
"glfw_dir": "E:\\Libraries\\glfw3",
"boost_dir": "E:\\Libraries\\boost_1_56_0",
"cuda_sdk": "/opt/cuda",
"opencl_sdk": "/opt/cuda"

"cuda_sdk": "/usr/local/cuda",
"opencl_sdk": "/usr",
"sdk_lib_dir": "lib"
}
9 changes: 6 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ struct Config {
glew_dir: String,
glfw_dir: String,
boost_dir: String,

// GPU backends
cuda_sdk: String,
opencl_sdk: String,
sdk_lib_dir: String,
}

macro_rules! t {
Expand Down Expand Up @@ -348,16 +351,16 @@ fn blob_backends(conf: &Config, build_dir: &std::path::PathBuf) -> (Vec<String>,
backend_dirs.push(format!("{}\\lib\\x64", conf.cuda_sdk));
backend_dirs.push(format!("{}\\nvvm\\lib\\x64", conf.cuda_sdk));
} else {
backend_dirs.push(format!("{}/lib64", conf.cuda_sdk));
backend_dirs.push(format!("{}/nvvm/lib64", conf.cuda_sdk));
backend_dirs.push(format!("{}/{}", conf.cuda_sdk, conf.sdk_lib_dir));
backend_dirs.push(format!("{}/nvvm/{}", conf.cuda_sdk, conf.sdk_lib_dir));
}
} else if conf.use_backend == "opencl" {
backends.push(("afopencl".to_string()));
backends.push("OpenCL".to_string());
if cfg!(windows) {
backend_dirs.push(format!("{}\\lib\\x64", conf.opencl_sdk));
} else {
backend_dirs.push(format!("{}/lib64", conf.opencl_sdk));
backend_dirs.push(format!("{}/{}", conf.opencl_sdk, conf.sdk_lib_dir));
}
}

Expand Down
13 changes: 12 additions & 1 deletion src/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ impl ConstGenerator for Complex<f64> {
}
}

#[allow(unused_mut)]
impl ConstGenerator for bool {
fn generate(&self, dims: Dim4) -> Array {
unsafe {
let mut temp: i64 = 0;
af_constant(&mut temp as MutAfArray, *self as c_int as c_double,
dims.ndims() as c_uint, dims.get().as_ptr() as *const DimT, 4);
Array::from(temp)
}
}
}

macro_rules! cnst {
($rust_type:ty, $ffi_type:expr) => (
#[allow(unused_mut)]
Expand All @@ -133,7 +145,6 @@ macro_rules! cnst {

cnst!(f32 , 0);
cnst!(f64 , 2);
cnst!(bool, 4);
cnst!(i32 , 5);
cnst!(u32 , 6);
cnst!(u8 , 7);
Expand Down