Skip to content

Set correct number of dimensions for convolve2_nn and convolve2_gradient_nn #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2022
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
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ fn run_cmake_command(conf: &Config, build_dir: &std::path::Path) {
run(
make_cmd
.arg(format!("-j{}", conf.build_threads))
.arg("install".to_string()),
.arg("install"),
"make",
);
}
Expand Down
32 changes: 12 additions & 20 deletions opencl-interop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,35 +88,27 @@ pub fn get_device_id() -> cl_device_id {
}

/// Set the cl_device_id as the active ArrayFire OpenCL device
pub fn set_device_id(dev_id: cl_device_id) {
unsafe {
let err_val = afcl_set_device_id(dev_id);
handle_error_general(AfError::from(err_val));
}
pub unsafe fn set_device_id(dev_id: cl_device_id) {
let err_val = afcl_set_device_id(dev_id);
handle_error_general(AfError::from(err_val));
}

/// Push user provided device, context and queue tuple to ArrayFire device mamanger
pub fn add_device_context(dev_id: cl_device_id, ctx: cl_context, queue: cl_command_queue) {
unsafe {
let err_val = afcl_add_device_context(dev_id, ctx, queue);
handle_error_general(AfError::from(err_val));
}
pub unsafe fn add_device_context(dev_id: cl_device_id, ctx: cl_context, queue: cl_command_queue) {
let err_val = afcl_add_device_context(dev_id, ctx, queue);
handle_error_general(AfError::from(err_val));
}

/// Set the device identified by device & context pair as the active device for ArrayFire
pub fn set_device_context(dev_id: cl_device_id, ctx: cl_context) {
unsafe {
let err_val = afcl_set_device_context(dev_id, ctx);
handle_error_general(AfError::from(err_val));
}
pub unsafe fn set_device_context(dev_id: cl_device_id, ctx: cl_context) {
let err_val = afcl_set_device_context(dev_id, ctx);
handle_error_general(AfError::from(err_val));
}

/// Remove the user provided device, context pair from ArrayFire device mamanger
pub fn delete_device_context(dev_id: cl_device_id, ctx: cl_context) {
unsafe {
let err_val = afcl_delete_device_context(dev_id, ctx);
handle_error_general(AfError::from(err_val));
}
pub unsafe fn delete_device_context(dev_id: cl_device_id, ctx: cl_context) {
let err_val = afcl_delete_device_context(dev_id, ctx);
handle_error_general(AfError::from(err_val));
}

///// Fetch Active ArrayFire device's type i.e. CPU/GPU/Accelerator etc.
Expand Down
12 changes: 6 additions & 6 deletions src/ml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ where
&mut temp as *mut af_array,
signal.get(),
filter.get(),
4,
2,
strides.get().as_ptr() as *const dim_t,
4,
2,
padding.get().as_ptr() as *const dim_t,
4,
2,
dilation.get().as_ptr() as *const dim_t,
);
HANDLE_ERROR(AfError::from(err_val));
Expand Down Expand Up @@ -126,11 +126,11 @@ where
original_signal.get(),
original_filter.get(),
convolved_output.get(),
4,
2,
strides.get().as_ptr() as *const dim_t,
4,
2,
padding.get().as_ptr() as *const dim_t,
4,
2,
dilation.get().as_ptr() as *const dim_t,
grad_type as c_uint,
);
Expand Down