本文整理汇总了C++中FREE_NULL_BITMAP函数的典型用法代码示例。如果您正苦于以下问题:C++ FREE_NULL_BITMAP函数的具体用法?C++ FREE_NULL_BITMAP怎么用?C++ FREE_NULL_BITMAP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FREE_NULL_BITMAP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _job_fits_in_active_row
/* Return 1 if job fits in this row, else return 0 */
static int _job_fits_in_active_row(struct job_record *job_ptr,
struct gs_part *p_ptr)
{
job_resources_t *job_res = job_ptr->job_resrcs;
int count;
bitstr_t *job_map;
uint16_t job_gr_type;
if ((p_ptr->active_resmap == NULL) || (p_ptr->jobs_active == 0))
return 1;
job_gr_type = _get_part_gr_type(job_ptr->part_ptr);
if ((job_gr_type == GS_CPU2) || (job_gr_type == GS_CORE) ||
(job_gr_type == GS_SOCKET)) {
return job_fits_into_cores(job_res, p_ptr->active_resmap,
gs_bits_per_node);
}
/* job_gr_type == GS_NODE || job_gr_type == GS_CPU */
job_map = bit_copy(job_res->node_bitmap);
bit_and(job_map, p_ptr->active_resmap);
/* any set bits indicate contention for the same resource */
count = bit_set_count(job_map);
if (slurmctld_conf.debug_flags & DEBUG_FLAG_GANG)
info("gang: _job_fits_in_active_row: %d bits conflict", count);
FREE_NULL_BITMAP(job_map);
if (count == 0)
return 1;
if (job_gr_type == GS_CPU) {
/* For GS_CPU we check the CPU arrays */
return _can_cpus_fit(job_ptr, p_ptr);
}
return 0;
}
示例2: reset_node_bitmap
/* Reset the node_bitmap in a job_resources data structure
* This is needed after a restart/reconfiguration since nodes can
* be added or removed from the system resulting in changing in
* the bitmap size or bit positions */
extern int reset_node_bitmap(job_resources_t *job_resrcs_ptr, uint32_t job_id)
{
int i;
if (!job_resrcs_ptr)
return SLURM_SUCCESS;
if (job_resrcs_ptr->node_bitmap)
FREE_NULL_BITMAP(job_resrcs_ptr->node_bitmap);
if (job_resrcs_ptr->nodes &&
(node_name2bitmap(job_resrcs_ptr->nodes, false,
&job_resrcs_ptr->node_bitmap))) {
error("Invalid nodes (%s) for job_id %u",
job_resrcs_ptr->nodes, job_id);
return SLURM_ERROR;
} else if (job_resrcs_ptr->nodes == NULL) {
job_resrcs_ptr->node_bitmap = bit_alloc(node_record_count);
}
i = bit_set_count(job_resrcs_ptr->node_bitmap);
if (job_resrcs_ptr->nhosts != i) {
error("Invalid change in resource allocation node count for "
"job %u, %u to %d", job_id, job_resrcs_ptr->nhosts, i);
return SLURM_ERROR;
}
return SLURM_SUCCESS;
}
示例3: powercap_get_job_optimal_cpufreq
int powercap_get_job_optimal_cpufreq(uint32_t powercap, int *allowed_freqs)
{
uint32_t cur_max_watts = 0, *tmp_max_watts_dvfs = NULL;
int k = 1;
bitstr_t *tmp_bitmap = NULL;
if (!_powercap_enabled())
return 0;
tmp_max_watts_dvfs = xmalloc(sizeof(uint32_t) * (allowed_freqs[0]+1));
tmp_bitmap = bit_copy(idle_node_bitmap);
bit_not(tmp_bitmap);
cur_max_watts = powercap_get_node_bitmap_maxwatts_dvfs(tmp_bitmap,
idle_node_bitmap, tmp_max_watts_dvfs,
allowed_freqs, 0);
FREE_NULL_BITMAP(tmp_bitmap);
if (cur_max_watts > powercap) {
while (tmp_max_watts_dvfs[k] > powercap &&
k < allowed_freqs[0] + 1) {
k++;
}
if (k == allowed_freqs[0] + 1)
k--;
} else {
k = 1;
}
xfree(tmp_max_watts_dvfs);
return k;
}
示例4: _re_wake
/* If slurmctld crashes, the node state that it recovers could differ
* from the actual hardware state (e.g. ResumeProgram failed to complete).
* To address that, when a node that should be powered up for a running
* job is not responding, they try running ResumeProgram again. */
static void _re_wake(void)
{
struct node_record *node_ptr;
bitstr_t *wake_node_bitmap = NULL;
int i;
node_ptr = node_record_table_ptr;
for (i=0; i<node_record_count; i++, node_ptr++) {
if (IS_NODE_ALLOCATED(node_ptr) &&
IS_NODE_NO_RESPOND(node_ptr) &&
!IS_NODE_POWER_SAVE(node_ptr) &&
(bit_test(suspend_node_bitmap, i) == 0) &&
(bit_test(resume_node_bitmap, i) == 0)) {
if (wake_node_bitmap == NULL) {
wake_node_bitmap =
bit_alloc(node_record_count);
}
bit_set(wake_node_bitmap, i);
}
}
if (wake_node_bitmap) {
char *nodes;
nodes = bitmap2node_name(wake_node_bitmap);
if (nodes) {
pid_t pid = _run_prog(resume_prog, nodes, NULL);
info("power_save: pid %d rewaking nodes %s",
(int) pid, nodes);
} else
error("power_save: bitmap2nodename");
xfree(nodes);
FREE_NULL_BITMAP(wake_node_bitmap);
}
}
示例5: _list_delete_part
/*
* _list_delete_part - delete an entry from the global partition list,
* see common/list.h for documentation
* global: node_record_count - count of nodes in the system
* node_record_table_ptr - pointer to global node table
*/
static void _list_delete_part(void *part_entry)
{
struct part_record *part_ptr;
struct node_record *node_ptr;
int i, j, k;
part_ptr = (struct part_record *) part_entry;
node_ptr = &node_record_table_ptr[0];
for (i = 0; i < node_record_count; i++, node_ptr++) {
for (j=0; j<node_ptr->part_cnt; j++) {
if (node_ptr->part_pptr[j] != part_ptr)
continue;
node_ptr->part_cnt--;
for (k=j; k<node_ptr->part_cnt; k++) {
node_ptr->part_pptr[k] =
node_ptr->part_pptr[k+1];
}
break;
}
}
xfree(part_ptr->allow_alloc_nodes);
xfree(part_ptr->allow_groups);
xfree(part_ptr->allow_uids);
xfree(part_ptr->alternate);
xfree(part_ptr->name);
xfree(part_ptr->nodes);
FREE_NULL_BITMAP(part_ptr->node_bitmap);
xfree(part_entry);
}
示例6: task_state_print
void task_state_print (task_state_t ts, log_f fn)
{
bitstr_t *unseen;
if (!ts) /* Not built yet */
return;
unseen = bit_alloc (ts->n_tasks);
if (bit_set_count (ts->start_failed)) {
_do_log_msg (ts->start_failed, fn, "failed to start");
bit_or (unseen, ts->start_failed);
}
if (bit_set_count (ts->running)) {
_do_log_msg (ts->running, fn, "running");
bit_or (unseen, ts->running);
}
if (bit_set_count (ts->abnormal_exit)) {
_do_log_msg (ts->abnormal_exit, fn, "exited abnormally");
bit_or (unseen, ts->abnormal_exit);
}
if (bit_set_count (ts->normal_exit)) {
_do_log_msg (ts->normal_exit, fn, "exited");
bit_or (unseen, ts->normal_exit);
}
bit_not (unseen);
if (bit_set_count (unseen))
_do_log_msg (unseen, fn, "unknown");
FREE_NULL_BITMAP(unseen);
}
示例7: hostlist2bitmap
/*
* hostlist2bitmap - given a hostlist, build a bitmap representation
* IN hl - hostlist
* IN best_effort - if set don't return an error on invalid node name entries
* OUT bitmap - set to bitmap, may not have all bits set on error
* RET 0 if no error, otherwise EINVAL
*/
extern int hostlist2bitmap (hostlist_t hl, bool best_effort, bitstr_t **bitmap)
{
int rc = SLURM_SUCCESS;
bitstr_t *my_bitmap;
char *name;
hostlist_iterator_t hi;
FREE_NULL_BITMAP(*bitmap);
my_bitmap = (bitstr_t *) bit_alloc (node_record_count);
*bitmap = my_bitmap;
hi = hostlist_iterator_create(hl);
while ((name = hostlist_next(hi)) != NULL) {
struct node_record *node_ptr;
node_ptr = _find_node_record(name, best_effort, true);
if (node_ptr) {
bit_set (my_bitmap, (bitoff_t) (node_ptr -
node_record_table_ptr));
} else {
error ("hostlist2bitmap: invalid node specified %s",
name);
if (!best_effort)
rc = EINVAL;
}
free (name);
}
hostlist_iterator_destroy(hi);
return rc;
}
示例8: _clear_power_config
/* Free all allocated memory */
static void _clear_power_config(void)
{
xfree(suspend_prog);
xfree(resume_prog);
xfree(exc_nodes);
xfree(exc_parts);
FREE_NULL_BITMAP(exc_node_bitmap);
}
示例9: _destroy_bitmap
static void _destroy_bitmap(void *object)
{
bitstr_t *bitstr = (bitstr_t *)object;
if (bitstr) {
FREE_NULL_BITMAP(bitstr);
}
}
示例10: _list_delete_feature
/* _list_delete_feature - delete an entry from the feature list,
* see list.h for documentation */
static void _list_delete_feature (void *feature_entry)
{
node_feature_t *feature_ptr = (node_feature_t *) feature_entry;
xassert(feature_ptr);
xassert(feature_ptr->magic == FEATURE_MAGIC);
xfree (feature_ptr->name);
FREE_NULL_BITMAP (feature_ptr->node_bitmap);
xfree (feature_ptr);
}
示例11: _destroy_local_cluster
static void _destroy_local_cluster(void *object)
{
local_cluster_t *local_cluster = (local_cluster_t *)object;
if (local_cluster) {
if (local_cluster->hl)
hostlist_destroy(local_cluster->hl);
FREE_NULL_BITMAP(local_cluster->asked_bitmap);
xfree(local_cluster);
}
}
示例12: _free_node_subgrp
static void _free_node_subgrp(void *object)
{
node_subgrp_t *subgrp = (node_subgrp_t *)object;
if (subgrp) {
FREE_NULL_BITMAP(subgrp->bitmap);
xfree(subgrp->str);
xfree(subgrp->inx);
xfree(subgrp);
}
}
示例13: fini
int fini(void)
{
#ifdef HAVE_NATIVE_CRAY
pthread_mutex_lock(&port_mutex);
FREE_NULL_BITMAP(port_resv);
pthread_mutex_unlock(&port_mutex);
#endif
return SLURM_SUCCESS;
}
示例14: _delete_gres_list
static void _delete_gres_list(void *x)
{
gres_slurmd_conf_t *p = (gres_slurmd_conf_t *) x;
xfree(p->cpus);
FREE_NULL_BITMAP(p->cpus_bitmap);
xfree(p->file);
xfree(p->links);
xfree(p->name);
xfree(p->type_name);
xfree(p);
}
示例15: _lllp_free_masks
static void _lllp_free_masks(const uint32_t maxtasks, bitstr_t **masks)
{
int i;
bitstr_t *bitmask;
for (i = 0; i < maxtasks; i++) {
bitmask = masks[i];
FREE_NULL_BITMAP(bitmask);
}
xfree(masks);
}