Skip to content

Commit

Permalink
Merge pull request #21 from hpc-gridware/JG_MEMCHECK_BRANCH
Browse files Browse the repository at this point in the history
CS-719 do full valgrind test on master branch (9.0.1)
  • Loading branch information
ernst-bablick authored Oct 26, 2024
2 parents 5f9772a + 0ef1705 commit 39672b8
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions source/libs/sgeobj/sge_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2599,7 +2599,7 @@ static int get_core_id_from_logical_core_number_solaris(const int** matrix,
/* ---------------------------------------------------------------------------*/
#if defined(OGE_HWLOC) || defined(BINDING_SOLARIS)

bool get_linear_automatic_socket_core_list_and_account(const int amount,
bool get_linear_automatic_socket_core_list_and_account(const int amount,
int** list_of_sockets, int* samount, int** list_of_cores, int* camount,
char** topo_by_job, int* topo_by_job_length)
{
Expand All @@ -2620,12 +2620,13 @@ bool get_linear_automatic_socket_core_list_and_account(const int amount,
int i;

/* get the topology which could be used by the job */
tmp_topo_busy = (char *) calloc(logical_used_topology_length, sizeof(char));
memcpy(tmp_topo_busy, logical_used_topology, logical_used_topology_length*sizeof(char));
tmp_topo_busy = sge_strdup(nullptr, logical_used_topology);
if (tmp_topo_busy == nullptr) {
return false;
}

/* 1. Find all free sockets and try to fit the request on them */
if (get_free_sockets(tmp_topo_busy, logical_used_topology_length, &sockets,
&sockets_size)) {
if (get_free_sockets(tmp_topo_busy, logical_used_topology_length, &sockets, &sockets_size)) {

/* there are free sockets: use them */
for (i = 0; i < sockets_size && used_cores < amount; i++) {
Expand Down Expand Up @@ -2975,8 +2976,10 @@ bool get_striding_first_socket_first_core_and_account(const int amount, const in
/* temporary accounting string -> account on this and
when eventually successful then copy this string back
to global topo_busy string */
tmp_topo_busy = (char *) calloc(logical_used_topology_length + 1, sizeof(char));
memcpy(tmp_topo_busy, logical_used_topology, logical_used_topology_length*sizeof(char));
tmp_topo_busy = sge_strdup(nullptr, logical_used_topology);
if (tmp_topo_busy == nullptr) {
return false;
}

DPRINTF("start_at_socket: %d, start_at_core: %d\n", start_at_socket, start_at_core);

Expand Down Expand Up @@ -3007,7 +3010,7 @@ bool get_striding_first_socket_first_core_and_account(const int amount, const in

/* check if we found the socket and core we want to start searching */
if (sc != start_at_socket || cc != start_at_core) {
/* could't find the start socket and start core */
/* couldn't find the start socket and start core */
sge_free(&tmp_topo_busy);
DRETURN(false);
}
Expand Down Expand Up @@ -3080,15 +3083,13 @@ static bool create_topology_used_per_job(char** accounted_topology, int* account
(*accounted_topology_length) = logical_used_topology_length;

/* copy string of current topology in use */
(*accounted_topology) = (char *)calloc(logical_used_topology_length+1, sizeof(char));
if ((*accounted_topology) == nullptr) {
*accounted_topology = sge_strdup(nullptr, logical_used_topology);
if (*accounted_topology == nullptr) {
/* out of memory */
return false;
}

memcpy((*accounted_topology), logical_used_topology, sizeof(char)*logical_used_topology_length);

/* revert all accounting from other jobs */
/* revert all accounting from other jobs */
for (i = 0; i < logical_used_topology_length; i++) {
if ((*accounted_topology)[i] == 'c') {
(*accounted_topology)[i] = 'C';
Expand Down

0 comments on commit 39672b8

Please sign in to comment.