Commit be757670 authored by Swann Perarnau's avatar Swann Perarnau
Browse files

Merge branch 'layout_cuda_fix' into 'staging'

Layout cuda fix

See merge request !137
parents 04254cf6 2d3cc234
Pipeline #10726 passed with stages
in 3 minutes and 31 seconds
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
* @{ * @{
**/ **/
#include <aml/area/cuda.h>
/** aml_layout data structure **/ /** aml_layout data structure **/
struct aml_layout_cuda_data { struct aml_layout_cuda_data {
/** Pointer to data on device. **/ /** Pointer to data on device. **/
......
...@@ -25,31 +25,21 @@ int aml_layout_cuda_create(struct aml_layout **out, ...@@ -25,31 +25,21 @@ int aml_layout_cuda_create(struct aml_layout **out,
struct aml_layout *layout; struct aml_layout *layout;
struct aml_layout_cuda_data *layout_data; struct aml_layout_cuda_data *layout_data;
layout = AML_INNER_MALLOC_EXTRA(struct aml_layout, layout = AML_INNER_MALLOC_ARRAY(3 * ndims, size_t, struct aml_layout,
struct aml_layout_cuda_data, size_t, struct aml_layout_cuda_data);
3 * ndims);
if (layout == NULL) if (layout == NULL)
return -AML_ENOMEM; return -AML_ENOMEM;
layout_data = AML_INNER_MALLOC_NEXTPTR(layout, struct aml_layout, layout_data = AML_INNER_MALLOC_GET_FIELD(layout, 2, struct aml_layout,
struct aml_layout_cuda_data); struct aml_layout_cuda_data);
layout_data->device_ptr = device_ptr; layout_data->device_ptr = device_ptr;
layout_data->order = order; layout_data->order = order;
layout_data->ndims = ndims; layout_data->ndims = ndims;
layout_data->dims = AML_INNER_MALLOC_GET_ARRAY(
layout_data->dims = AML_INNER_MALLOC_EXTRA_NEXTPTR( layout, size_t, struct aml_layout, struct aml_layout_cuda_data);
layout, struct aml_layout, struct aml_layout_cuda_data, size_t, layout_data->stride = layout_data->dims + ndims;
0); layout_data->cpitch = layout_data->stride + ndims;
layout_data->stride = AML_INNER_MALLOC_EXTRA_NEXTPTR(
layout, struct aml_layout, struct aml_layout_cuda_data, size_t,
ndims);
layout_data->cpitch = AML_INNER_MALLOC_EXTRA_NEXTPTR(
layout, struct aml_layout, struct aml_layout_cuda_data, size_t,
ndims * 2);
// Store dims, stride and cpitch are internally stored in fortran // Store dims, stride and cpitch are internally stored in fortran
// row major. // row major.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment