On Mon, Mar 22, 2010 at 11:20, <sthibaul_at_[hidden]> wrote:
> Author: sthibaul
> Date: 2010-03-22 06:20:31 EDT (Mon, 22 Mar 2010)
> New Revision: 1840
> URL: https://svn.open-mpi.org/trac/hwloc/changeset/1840
>
> Modified: trunk/src/topology-aix.c
> ==============================================================================
> --- trunk/src/topology-aix.c   (original)
> +++ trunk/src/topology-aix.c   2010-03-22 06:20:31 EDT (Mon, 22 Mar 2010)
> @@ -73,28 +73,29 @@
> Â return res;
> Â }
>
> -static hwloc_cpuset_t
> -hwloc_aix_get_sth_cpubind(hwloc_topology_t topology, rstype_t what, rsid_t who, int policy __hwloc_attribute_unused)
> +static int
> +hwloc_aix_get_sth_cpubind(hwloc_topology_t topology, rstype_t what, rsid_t who, hwloc_cpuset_t hwloc_set, int policy __hwloc_attribute_unused)
> Â {
> - Â hwloc_cpuset_t hwloc_set = NULL;
> Â rsethandle_t rset;
> Â unsigned cpu, maxcpus;
> + Â int res = -1;
>
> Â rset = rs_alloc(RS_EMPTY);
>
> Â if (ra_getrset(what, who, 0, rset) == -1)
> Â Â goto out;
>
> - Â hwloc_set = hwloc_cpuset_alloc();
> + Â hwloc_cpuset_zero(hwloc_set);
> Â maxcpus = rs_getinfo(rset, R_MAXPROCS, 0);
> Â for (cpu = 0; cpu < maxcpus; cpu++)
> Â Â if (rs_op(RS_TESTRESOURCE, rset, NULL, R_PROCS, cpu) == 1)
> Â Â Â hwloc_cpuset_set(hwloc_set, cpu);
> Â hwloc_cpuset_andset(hwloc_set, hwloc_topology_get_complete_cpuset(topology));
> + Â res = 0;
>
> Â out:
> Â rs_free(rset);
> - Â return hwloc_set;
> + Â return res;
> Â }
>
> Â static int
> @@ -104,11 +105,11 @@
> Â return hwloc_aix_set_sth_cpubind(topology, R_PROCESS, who, hwloc_set, policy);
> Â }
>
> -static hwloc_cpuset_t
> -hwloc_aix_get_thisproc_cpubind(hwloc_topology_t topology, int policy)
> +static int
> +hwloc_aix_get_thisproc_cpubind(hwloc_topology_t topology, hwloc_cpuset_t hwloc_set, int policy)
> Â {
> Â rsid_t who = { .at_pid = getpid() };
This one came to my intention while looking over the commit, but
shouldn't this be topology->pid as of r1837?
Bert
> - Â return hwloc_aix_get_sth_cpubind(topology, R_PROCESS, who, policy);
> + Â return hwloc_aix_get_sth_cpubind(topology, R_PROCESS, who, hwloc_set, policy);
> Â }
>
> Â static int
> @@ -118,11 +119,11 @@
> Â return hwloc_aix_set_sth_cpubind(topology, R_THREAD, who, hwloc_set, policy);
> Â }
>
> -static hwloc_cpuset_t
> -hwloc_aix_get_thisthread_cpubind(hwloc_topology_t topology, int policy)
> +static int
> +hwloc_aix_get_thisthread_cpubind(hwloc_topology_t topology, hwloc_cpuset_t hwloc_set, int policy)
> Â {
> Â rsid_t who = { .at_tid = thread_self() };
> - Â return hwloc_aix_get_sth_cpubind(topology, R_THREAD, who, policy);
> + Â return hwloc_aix_get_sth_cpubind(topology, R_THREAD, who, hwloc_set, policy);
> Â }
>
> Â static int
> @@ -132,11 +133,11 @@
> Â return hwloc_aix_set_sth_cpubind(topology, R_PROCESS, who, hwloc_set, policy);
> Â }
>
> -static hwloc_cpuset_t
> -hwloc_aix_get_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, int policy)
> +static int
> +hwloc_aix_get_proc_cpubind(hwloc_topology_t topology, hwloc_pid_t pid, hwloc_cpuset_t hwloc_set, int policy)
> Â {
> Â rsid_t who = { .at_pid = pid };
> - Â return hwloc_aix_get_sth_cpubind(topology, R_PROCESS, who, policy);
> + Â return hwloc_aix_get_sth_cpubind(topology, R_PROCESS, who, hwloc_set, policy);
> Â }
>
> Â static int
> @@ -152,16 +153,16 @@
> Â }
> Â }
>
> -static hwloc_cpuset_t
> -hwloc_aix_get_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t pthread, int policy)
> +static int
> +hwloc_aix_get_thread_cpubind(hwloc_topology_t topology, hwloc_thread_t pthread, hwloc_cpuset_t hwloc_set, int policy)
> Â {
> Â struct __pthrdsinfo info;
> Â int size;
> Â if (pthread_getthrds_np(&pthread, PTHRDSINFO_QUERY_TID, &info, sizeof(info), NULL, &size))
> - Â Â return NULL;
> + Â Â return -1;
> Â {
> Â Â rsid_t who = { .at_tid = info.__pi_tid };
> - Â Â return hwloc_aix_get_sth_cpubind(topology, R_THREAD, who, policy);
> + Â Â return hwloc_aix_get_sth_cpubind(topology, R_THREAD, who, hwloc_set, policy);
> Â }
> Â }
>
>
|