Skip to content

Commit 982ebdf

Browse files
committed
Merge pull request #19 from jramapuram/hotfix/build
Hotfix/build
2 parents c5c9ba7 + 58c489e commit 982ebdf

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

build.conf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build_cpu": "ON",
1313
"build_examples": "OFF",
1414
"build_test": "OFF",
15-
"build_graphics": "OFF",
15+
"build_graphics": "OFF",
1616

1717
"glew_static": "OFF",
1818
"freeimage_type": "DYNAMIC",
@@ -28,6 +28,8 @@
2828
"glew_dir": "E:\\Libraries\\GLEW",
2929
"glfw_dir": "E:\\Libraries\\glfw3",
3030
"boost_dir": "E:\\Libraries\\boost_1_56_0",
31-
"cuda_sdk": "/opt/cuda",
32-
"opencl_sdk": "/opt/cuda"
31+
32+
"cuda_sdk": "/usr/local/cuda",
33+
"opencl_sdk": "/usr",
34+
"sdk_lib_dir": "lib"
3335
}

build.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,11 @@ struct Config {
4848
glew_dir: String,
4949
glfw_dir: String,
5050
boost_dir: String,
51+
52+
// GPU backends
5153
cuda_sdk: String,
5254
opencl_sdk: String,
55+
sdk_lib_dir: String,
5356
}
5457

5558
macro_rules! t {
@@ -348,16 +351,16 @@ fn blob_backends(conf: &Config, build_dir: &std::path::PathBuf) -> (Vec<String>,
348351
backend_dirs.push(format!("{}\\lib\\x64", conf.cuda_sdk));
349352
backend_dirs.push(format!("{}\\nvvm\\lib\\x64", conf.cuda_sdk));
350353
} else {
351-
backend_dirs.push(format!("{}/lib64", conf.cuda_sdk));
352-
backend_dirs.push(format!("{}/nvvm/lib64", conf.cuda_sdk));
354+
backend_dirs.push(format!("{}/{}", conf.cuda_sdk, conf.sdk_lib_dir));
355+
backend_dirs.push(format!("{}/nvvm/{}", conf.cuda_sdk, conf.sdk_lib_dir));
353356
}
354357
} else if conf.use_backend == "opencl" {
355358
backends.push(("afopencl".to_string()));
356359
backends.push("OpenCL".to_string());
357360
if cfg!(windows) {
358361
backend_dirs.push(format!("{}\\lib\\x64", conf.opencl_sdk));
359362
} else {
360-
backend_dirs.push(format!("{}/lib64", conf.opencl_sdk));
363+
backend_dirs.push(format!("{}/{}", conf.opencl_sdk, conf.sdk_lib_dir));
361364
}
362365
}
363366

src/data/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ impl ConstGenerator for Complex<f64> {
114114
}
115115
}
116116

117+
#[allow(unused_mut)]
118+
impl ConstGenerator for bool {
119+
fn generate(&self, dims: Dim4) -> Array {
120+
unsafe {
121+
let mut temp: i64 = 0;
122+
af_constant(&mut temp as MutAfArray, *self as c_int as c_double,
123+
dims.ndims() as c_uint, dims.get().as_ptr() as *const DimT, 4);
124+
Array::from(temp)
125+
}
126+
}
127+
}
128+
117129
macro_rules! cnst {
118130
($rust_type:ty, $ffi_type:expr) => (
119131
#[allow(unused_mut)]
@@ -133,7 +145,6 @@ macro_rules! cnst {
133145

134146
cnst!(f32 , 0);
135147
cnst!(f64 , 2);
136-
cnst!(bool, 4);
137148
cnst!(i32 , 5);
138149
cnst!(u32 , 6);
139150
cnst!(u8 , 7);

0 commit comments

Comments
 (0)