What
Update clang format
Why ?
Make formatting stable
How ?
Change function wrap:
When function declaration cannot be placed on a single line then place all arguments on a second line
/* before */
static inline void
ucc_knomial_pattern_init(ucc_rank_t size, ucc_rank_t rank, ucc_kn_radix_t radix,
ucc_knomial_pattern_t *p)
{
ucc_knomial_pattern_init_impl(size, rank, radix, p, 0, 1);
}
/* after */
static inline void ucc_knomial_pattern_init(
ucc_rank_t size, ucc_rank_t rank, ucc_kn_radix_t radix,
ucc_knomial_pattern_t *p)
{
ucc_knomial_pattern_init_impl(size, rank, radix, p, 0, 1);
}
When function call cannot be placed on a single line then place one arg per line
/* before */
status =
ucc_mc_memcpy(rbuf, scratch_header->addr, tsize * data_size,
rmem, UCC_MEMORY_TYPE_HOST);
if (ucc_unlikely(status != UCC_OK)) {
tl_error(UCC_TASK_LIB(task),
"failed to copy from scratch buffer to dst");
task->super.status = status;
return;
}
/* after */
status = ucc_mc_memcpy(
rbuf,
scratch_header->addr,
tsize * data_size,
rmem,
UCC_MEMORY_TYPE_HOST);
if (ucc_unlikely(status != UCC_OK)) {
tl_error(
UCC_TASK_LIB(task),
"failed to copy from scratch buffer to dst");
task->super.status = status;
return;
}
reflow comments
/* before */
/**
* Computes actual radix at current iteration
* @param [in] p ucc_knomial_pattern
* @return radix
*/
static inline
ucc_rank_t ucc_kn_compute_step_radix(ucc_knomial_pattern_t *p);
/* after */
/**
* Computes actual radix at current iteration
* @param [in] p ucc_knomial_pattern
* @return radix
*/
static inline ucc_rank_t ucc_kn_compute_step_radix(ucc_knomial_pattern_t *p)
Please avoid using inline comments as they break alignment. E.g.
/*with inline comments*/
typedef struct ucc_knomial_pattern {
ucc_kn_radix_t radix; /* knomial tree radix */
uint8_t type; /* pattern type */
uint8_t iteration; /* current iteration */
uint8_t n_iters; /* number of iterations in knomial algorithm */
uint8_t
pow_radix_sup; /* smallest integer N such that (radix ** N) >= size */
uint8_t node_type; /* type of current rank: BASE, PROXY or EXTRA */
uint8_t backward; /* boolean, iteration direction */
ucc_rank_t
radix_pow; /* power of radix for current algorithm iteration
* forward: initial value is 1
* backward: initial valus is full_pow_size if have >1 full subtrees, OR
* (full_pow_size / radix) otherwise
*/
ucc_rank_t
full_pow_size; /* largest power of radix <= size. It is equal to
* (radix ** pow_radix_sup) if (radix ** pow_radix_sup) == size, OR
* (radix ** (_pow_radix_sup - 1)) otherwise
*/
ucc_rank_t size; /* total number of ranks */
ucc_rank_t rank; /* process rank */
ucc_rank_t n_extra; /* number of "extra" ranks to be served by "proxies" */
size_t block_size_counts;
size_t count; /* collective buffer size */
ucc_count_t *counts;
ucc_rank_t block_size;
ptrdiff_t block_offset;
int is64;
} ucc_knomial_pattern_t;
/* no inline comments */
typedef struct ucc_knomial_pattern {
/* knomial tree radix */
ucc_kn_radix_t radix;
/* pattern type */
uint8_t type;
/* current iteration */
uint8_t iteration;
/* number of iterations in knomial algorithm */
uint8_t n_iters;
/* smallest integer N such that (radix ** N) >= size */
uint8_t pow_radix_sup;
/* type of current rank: BASE, PROXY or EXTRA */
uint8_t node_type;
/* boolean, iteration direction */
uint8_t backward;
/* power of radix for current algorithm iteration
* forward: initial value is 1
* backward: initial valus is full_pow_size if have >1 full subtrees, OR
* (full_pow_size / radix) otherwise
*/
ucc_rank_t radix_pow;
/* largest power of radix <= size. It is equal to
* (radix ** pow_radix_sup) if (radix ** pow_radix_sup) == size, OR
* (radix ** (_pow_radix_sup - 1)) otherwise
*/
ucc_rank_t full_pow_size;
/* total number of ranks */
ucc_rank_t size;
/* process rank */
ucc_rank_t rank;
/* number of "extra" ranks to be served by "proxies" */
ucc_rank_t n_extra;
size_t block_size_counts;
/* collective buffer size */
size_t count;
ucc_count_t *counts;
ucc_rank_t block_size;
ptrdiff_t block_offset;
int is64;
} ucc_knomial_pattern_t;
What
Update clang format
Why ?
Make formatting stable
How ?
Change function wrap:
When function declaration cannot be placed on a single line then place all arguments on a second line
When function call cannot be placed on a single line then place one arg per line
reflow comments
Please avoid using inline comments as they break alignment. E.g.