Skip to content

Commit

Permalink
coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
uecker committed Mar 25, 2024
1 parent 911c0eb commit e6e1d1f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/num/gpuops.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

#include "gpuops.h"

#define MiBYTE (1024*1024)
#define MiBYTE (1024 * 1024)

static int cuda_stream_level = -1;
cudaStream_t cuda_streams[CUDA_MAX_STREAMS + 1];
Expand Down Expand Up @@ -391,7 +391,7 @@ static bool cuda_ondevice_int(const void* ptr)

bool cuda_ondevice(const void* ptr)
{
return cuda_ondevice_int(ptr)|| is_vptr_gpu(ptr);
return cuda_ondevice_int(ptr) || is_vptr_gpu(ptr);
}


Expand Down Expand Up @@ -599,5 +599,5 @@ const struct vec_iter_s gpu_iter_ops = {
.axpy_bat = cuda_axpy_bat,

};

#endif

14 changes: 7 additions & 7 deletions src/num/vptr.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static int hint_get_rank(int N, const long pos[N], struct vptr_hint_s* hint)

for (int i = 0; i < N; i++) {

offset += stride * (1 == hint->dims[i] ? 0 : pos[i]);
offset += stride * ((1 == hint->dims[i]) ? 0 : pos[i]);
stride *= hint->dims[i];
}

Expand All @@ -76,7 +76,7 @@ struct vptr_hint_s* vptr_hint_ref(struct vptr_hint_s* hint)

static void vptr_hint_del(const struct shared_obj_s* sptr)
{
const struct vptr_hint_s* hint = CONTAINER_OF(sptr, const struct vptr_hint_s, sptr);
auto hint = CONTAINER_OF(sptr, const struct vptr_hint_s, sptr);

xfree(hint->dims);
xfree(hint->rank);
Expand Down Expand Up @@ -277,7 +277,7 @@ static struct mem_s* vptr_create(int N, const long dims[N], size_t size, struct
x->mpi_flags = md_nontriv_dims(N, dims) & hint->mpi_flags;

x->block_size = size; // size of continous blocks located on one rank
//

for (int i = 0; (i < N) && !MD_IS_SET(x->mpi_flags, i); i++)
x->block_size *= x->dims[i];

Expand All @@ -302,8 +302,8 @@ static void* vptr_resolve_int(const void* ptr, bool assert_rank)

if (assert_rank)
error("Trying to access %x from rank %d!\n", ptr, mpi_get_rank());
else
return NULL;

return NULL;
}

#pragma omp critical(bart_vmap)
Expand Down Expand Up @@ -368,11 +368,11 @@ bool vptr_free(const void* ptr)
if (NULL == mem)
return false;

if (mem->free && NULL != mem->mem) {
if (mem->free && (NULL != mem->mem)) {

md_free(mem->mem[0]);

for (int i = 1; i < mem->num_blocks && !mem->free_first_only; i++)
for (int i = 1; (i < mem->num_blocks) && !mem->free_first_only; i++)
md_free(mem->mem[i]);

} else {
Expand Down
2 changes: 2 additions & 0 deletions src/pics.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,10 @@ int main_pics(int argc, char* argv[argc])
hint = hint_mpi_create(mpi_flags, DIMS, ksp_dims);

kspace_p = vptr_wrap(DIMS, ksp_dims, CFL_SIZE, kspace, hint, false, false);

if (NULL != traj)
traj_p = vptr_wrap(DIMS, traj_dims, CFL_SIZE, traj, hint, false, false);

maps_p = vptr_wrap(DIMS, map_dims, CFL_SIZE, maps, hint, false, false);
}

Expand Down

0 comments on commit e6e1d1f

Please sign in to comment.