Remove a few useless files that were missed last night.
This commit was SVN r24218.
Этот коммит содержится в:
родитель
54cb4eb2b5
Коммит
cd8f12d8e5
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2010 INRIA
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <private/config.h>
|
||||
#include <hwloc.h>
|
||||
|
||||
/* check the CUDA Driver API helpers */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
hwloc_topology_t topology;
|
||||
int size1, size2;
|
||||
char *buf1, *buf2;
|
||||
int err = 0;
|
||||
|
||||
hwloc_topology_init(&topology);
|
||||
hwloc_topology_load(topology);
|
||||
assert(hwloc_topology_is_thissystem(topology));
|
||||
hwloc_topology_export_xmlbuffer(topology, &buf1, &size1);
|
||||
hwloc_topology_destroy(topology);
|
||||
printf("exported to buffer %p length %d\n", buf1, size1);
|
||||
|
||||
hwloc_topology_init(&topology);
|
||||
hwloc_topology_set_xmlbuffer(topology, buf1, size1);
|
||||
hwloc_topology_load(topology);
|
||||
assert(!hwloc_topology_is_thissystem(topology));
|
||||
hwloc_topology_export_xmlbuffer(topology, &buf2, &size2);
|
||||
hwloc_topology_destroy(topology);
|
||||
printf("re-exported to buffer %p length %d\n", buf2, size2);
|
||||
|
||||
if (strcmp(buf1, buf2)) {
|
||||
printf("### First exported buffer is:\n");
|
||||
printf("%s", buf1);
|
||||
printf("### End of first export buffer\n");
|
||||
printf("### Second exported buffer is:\n");
|
||||
printf("%s", buf2);
|
||||
printf("### End of second export buffer\n");
|
||||
err = 1;
|
||||
}
|
||||
|
||||
xmlFree(BAD_CAST buf1);
|
||||
xmlFree(BAD_CAST buf2);
|
||||
|
||||
return err;
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
.\" -*- nroff -*-
|
||||
.\" Copyright © 2010 INRIA
|
||||
.\" Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
|
||||
.TH HWLOC-PS "1" "#HWLOC_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
|
||||
.SH NAME
|
||||
hwloc-ps \- List currently-running processes that are bound.
|
||||
.
|
||||
.\" **************************
|
||||
.\" Synopsis Section
|
||||
.\" **************************
|
||||
.SH SYNOPSIS
|
||||
.
|
||||
.B hwloc-ps
|
||||
[\fIoptions\fR]
|
||||
.
|
||||
.\" **************************
|
||||
.\" Options Section
|
||||
.\" **************************
|
||||
.SH OPTIONS
|
||||
.
|
||||
.TP 10
|
||||
\fB\-a\fR
|
||||
list all processes, even those that are not bound to any
|
||||
specific part of the machine.
|
||||
.TP
|
||||
\fB\-p\fR \fB\-\-physical\fR
|
||||
report OS/physical indexes instead of logical indexes
|
||||
.TP
|
||||
\fB\-l\fR \fB\-\-logical\fR
|
||||
report logical indexes instead of physical/OS indexes (default)
|
||||
.TP
|
||||
\fB\-c\fR \fB\-\-cpuset\fR
|
||||
show process bindings as cpusets instead of objects.
|
||||
.
|
||||
.\" **************************
|
||||
.\" Description Section
|
||||
.\" **************************
|
||||
.SH DESCRIPTION
|
||||
.
|
||||
By default, hwloc-ps lists only those currently-running processes that
|
||||
are bound; it displays their their identifier, command-line and
|
||||
binding. The binding may be reported as objects or cpusets.
|
||||
.
|
||||
The output is a plain list. If you wish to annotate the hierarchical
|
||||
topology with processes so as to see how they are actual distributed
|
||||
on the machine, you might want to use lstopo --ps instead (which also
|
||||
only shows processes that are bound).
|
||||
.
|
||||
.PP
|
||||
The
|
||||
.I -a
|
||||
switch can be used to show
|
||||
.I all
|
||||
processes, if desired.
|
||||
.
|
||||
.\" **************************
|
||||
.\" See also section
|
||||
.\" **************************
|
||||
.SH SEE ALSO
|
||||
.
|
||||
.ft R
|
||||
hwloc(7), lstopo(1), hwloc-calc(1), hwloc-distrib(1)
|
||||
.sp
|
@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009-2010 INRIA
|
||||
* Copyright © 2009 Université Bordeaux 1
|
||||
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include <private/config.h>
|
||||
#include <hwloc.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
static void usage(char *name, FILE *where)
|
||||
{
|
||||
fprintf (where, "Usage: %s [ options ] ... [ filename ]\n", name);
|
||||
fprintf (where, "Options:\n");
|
||||
fprintf (where, " -a Show all processes, including those that are not bound\n");
|
||||
fprintf (where, " -l --logical Use logical object indexes (default)\n");
|
||||
fprintf (where, " -p --physical Use physical object indexes\n");
|
||||
fprintf (where, " -c --cpuset Show cpuset instead of objects\n");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const struct hwloc_topology_support *support;
|
||||
hwloc_topology_t topology;
|
||||
hwloc_obj_t root;
|
||||
hwloc_bitmap_t cpuset;
|
||||
int logical = 1;
|
||||
int show_cpuset = 0;
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
int show_all = 0;
|
||||
char *callname;
|
||||
int err;
|
||||
int opt;
|
||||
|
||||
callname = strrchr(argv[0], '/');
|
||||
if (!callname)
|
||||
callname = argv[0];
|
||||
else
|
||||
callname++;
|
||||
|
||||
while (argc >= 2) {
|
||||
opt = 0;
|
||||
if (!strcmp(argv[1], "-a"))
|
||||
show_all = 1;
|
||||
else if (!strcmp(argv[1], "-l") || !strcmp(argv[1], "--logical")) {
|
||||
logical = 1;
|
||||
} else if (!strcmp(argv[1], "-p") || !strcmp(argv[1], "--physical")) {
|
||||
logical = 0;
|
||||
} else if (!strcmp(argv[1], "-c") || !strcmp(argv[1], "--cpuset")) {
|
||||
show_cpuset = 1;
|
||||
} else {
|
||||
fprintf (stderr, "Unrecognized option: %s\n", argv[1]);
|
||||
usage (callname, stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
argc -= opt+1;
|
||||
argv += opt+1;
|
||||
}
|
||||
|
||||
err = hwloc_topology_init(&topology);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
err = hwloc_topology_load(topology);
|
||||
if (err)
|
||||
goto out_with_topology;
|
||||
|
||||
root = hwloc_get_root_obj(topology);
|
||||
|
||||
support = hwloc_topology_get_support(topology);
|
||||
|
||||
if (!support->cpubind->get_thisproc_cpubind)
|
||||
goto out_with_topology;
|
||||
|
||||
dir = opendir("/proc");
|
||||
if (!dir)
|
||||
goto out_with_topology;
|
||||
|
||||
cpuset = hwloc_bitmap_alloc();
|
||||
if (!cpuset)
|
||||
goto out_with_dir;
|
||||
|
||||
while ((dirent = readdir(dir))) {
|
||||
long pid;
|
||||
char *end;
|
||||
char name[64] = "";
|
||||
char *cpuset_str = NULL;
|
||||
|
||||
pid = strtol(dirent->d_name, &end, 10);
|
||||
if (*end)
|
||||
/* Not a number */
|
||||
continue;
|
||||
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
{
|
||||
char path[6 + strlen(dirent->d_name) + 1 + 7 + 1];
|
||||
int file;
|
||||
ssize_t n;
|
||||
|
||||
snprintf(path, sizeof(path), "/proc/%s/cmdline", dirent->d_name);
|
||||
|
||||
if ((file = open(path, O_RDONLY)) >= 0) {
|
||||
n = read(file, name, sizeof(name) - 1);
|
||||
close(file);
|
||||
|
||||
if (n <= 0)
|
||||
/* Ignore kernel threads and errors */
|
||||
continue;
|
||||
name[n] = 0;
|
||||
}
|
||||
}
|
||||
#endif /* HWLOC_LINUX_SYS */
|
||||
|
||||
if (hwloc_get_proc_cpubind(topology, pid, cpuset, 0))
|
||||
continue;
|
||||
|
||||
if (hwloc_bitmap_isequal(cpuset, root->cpuset) && !show_all)
|
||||
continue;
|
||||
|
||||
printf("%ld\t", pid);
|
||||
|
||||
if (show_cpuset) {
|
||||
hwloc_bitmap_asprintf(&cpuset_str, cpuset);
|
||||
printf("%s", cpuset_str);
|
||||
} else {
|
||||
hwloc_bitmap_t remaining = hwloc_bitmap_dup(cpuset);
|
||||
int first = 1;
|
||||
while (!hwloc_bitmap_iszero(remaining)) {
|
||||
char type[64];
|
||||
unsigned idx;
|
||||
hwloc_obj_t obj = hwloc_get_first_largest_obj_inside_cpuset(topology, remaining);
|
||||
hwloc_obj_type_snprintf(type, sizeof(type), obj, 1);
|
||||
idx = logical ? obj->logical_index : obj->os_index;
|
||||
if (idx == (unsigned) -1)
|
||||
printf("%s%s", first ? "" : " ", type);
|
||||
else
|
||||
printf("%s%s:%u", first ? "" : " ", type, idx);
|
||||
hwloc_bitmap_andnot(remaining, remaining, obj->cpuset);
|
||||
first = 0;
|
||||
}
|
||||
hwloc_bitmap_free(remaining);
|
||||
}
|
||||
|
||||
printf("\t\t%s\n", name);
|
||||
free(cpuset_str);
|
||||
}
|
||||
|
||||
err = 0;
|
||||
hwloc_bitmap_free(cpuset);
|
||||
|
||||
out_with_dir:
|
||||
closedir(dir);
|
||||
out_with_topology:
|
||||
hwloc_topology_destroy(topology);
|
||||
out:
|
||||
return err;
|
||||
}
|
@ -1,204 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2009 CNRS
|
||||
* Copyright © 2009-2010 INRIA
|
||||
* Copyright © 2009-2010 Université Bordeaux 1
|
||||
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
|
||||
* See COPYING in top-level directory.
|
||||
*/
|
||||
|
||||
#include <private/config.h>
|
||||
#include <hwloc.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
|
||||
extern void usage(const char *name, FILE *where);
|
||||
|
||||
static inline void
|
||||
hwloc_utils_input_format_usage(FILE *where, int addspaces)
|
||||
{
|
||||
#ifdef HWLOC_HAVE_XML
|
||||
fprintf (where, " --input <XML file>\n");
|
||||
fprintf (where, " -i <XML file> %*sRead topology from XML file <path>\n",
|
||||
addspaces, " ");
|
||||
#endif
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
fprintf (where, " --input <directory>\n");
|
||||
fprintf (where, " -i <directory> %*sRead topology from chroot containing the /proc and /sys\n",
|
||||
addspaces, " ");
|
||||
fprintf (where, " %*sof another system\n",
|
||||
addspaces, " ");
|
||||
#endif
|
||||
fprintf (where, " --input \"n:2 2\"\n");
|
||||
fprintf (where, " -i \"n:2 2\" %*sSimulate a fake hierarchy, here with 2 NUMA nodes of 2\n",
|
||||
addspaces, " ");
|
||||
fprintf (where, " %*sprocessors\n",
|
||||
addspaces, " ");
|
||||
fprintf (where, " --input-format <format>\n");
|
||||
fprintf (where, " --if <format> %*sEnforce input format among "
|
||||
#ifdef HWLOC_HAVE_XML
|
||||
"xml, "
|
||||
#endif
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
"fsroot, "
|
||||
#endif
|
||||
"synthetic\n",
|
||||
addspaces, " ");
|
||||
}
|
||||
|
||||
enum hwloc_utils_input_format {
|
||||
HWLOC_UTILS_INPUT_DEFAULT,
|
||||
HWLOC_UTILS_INPUT_XML,
|
||||
HWLOC_UTILS_INPUT_FSROOT,
|
||||
HWLOC_UTILS_INPUT_SYNTHETIC
|
||||
};
|
||||
|
||||
static inline enum hwloc_utils_input_format
|
||||
hwloc_utils_parse_input_format(const char *name, const char *callname)
|
||||
{
|
||||
if (!strncasecmp(name, "default", 3))
|
||||
return HWLOC_UTILS_INPUT_DEFAULT;
|
||||
else if (!strncasecmp(name, "xml", 1))
|
||||
return HWLOC_UTILS_INPUT_XML;
|
||||
else if (!strncasecmp(name, "fsroot", 1))
|
||||
return HWLOC_UTILS_INPUT_FSROOT;
|
||||
else if (!strncasecmp(name, "synthetic", 1))
|
||||
return HWLOC_UTILS_INPUT_SYNTHETIC;
|
||||
|
||||
fprintf(stderr, "input format `%s' not supported\n", name);
|
||||
usage(callname, stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
static inline int
|
||||
hwloc_utils_lookup_input_option(char *argv[], int argc, int *consumed_opts,
|
||||
char **inputp, enum hwloc_utils_input_format *input_formatp,
|
||||
const char *callname)
|
||||
{
|
||||
if (!strcmp (argv[0], "--input")
|
||||
|| !strcmp (argv[0], "-i")) {
|
||||
if (argc <= 1) {
|
||||
usage (callname, stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (strlen(argv[1]))
|
||||
*inputp = argv[1];
|
||||
else
|
||||
*inputp = NULL;
|
||||
*consumed_opts = 1;
|
||||
return 1;
|
||||
}
|
||||
else if (!strcmp (argv[0], "--input-format")
|
||||
|| !strcmp (argv[0], "--if")) {
|
||||
if (argc <= 1) {
|
||||
usage (callname, stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
*input_formatp = hwloc_utils_parse_input_format (argv[1], callname);
|
||||
*consumed_opts = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* backward compat with 1.0 */
|
||||
else if (!strcmp (argv[0], "--synthetic")) {
|
||||
if (argc <= 1) {
|
||||
usage (callname, stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
*inputp = argv[1];
|
||||
*input_formatp = HWLOC_UTILS_INPUT_SYNTHETIC;
|
||||
*consumed_opts = 1;
|
||||
return 1;
|
||||
} else if (!strcmp (argv[0], "--xml")) {
|
||||
if (argc <= 1) {
|
||||
usage (callname, stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
*inputp = argv[1];
|
||||
*input_formatp = HWLOC_UTILS_INPUT_XML;
|
||||
*consumed_opts = 1;
|
||||
return 1;
|
||||
} else if (!strcmp (argv[0], "--fsys-root")) {
|
||||
if (argc <= 1) {
|
||||
usage (callname, stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
*inputp = argv[1];
|
||||
*input_formatp = HWLOC_UTILS_INPUT_FSROOT;
|
||||
*consumed_opts = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
hwloc_utils_enable_input_format(struct hwloc_topology *topology,
|
||||
const char *input,
|
||||
enum hwloc_utils_input_format input_format,
|
||||
int verbose, const char *callname)
|
||||
{
|
||||
if (input_format == HWLOC_UTILS_INPUT_DEFAULT) {
|
||||
struct stat inputst;
|
||||
int err;
|
||||
err = stat(input, &inputst);
|
||||
if (err < 0) {
|
||||
if (verbose)
|
||||
printf("assuming `%s' is a synthetic topology description\n", input);
|
||||
input_format = HWLOC_UTILS_INPUT_SYNTHETIC;
|
||||
} else if (S_ISDIR(inputst.st_mode)) {
|
||||
if (verbose)
|
||||
printf("assuming `%s' is a file-system root\n", input);
|
||||
input_format = HWLOC_UTILS_INPUT_FSROOT;
|
||||
} else if (S_ISREG(inputst.st_mode)) {
|
||||
if (verbose)
|
||||
printf("assuming `%s' is a XML file\n", input);
|
||||
input_format = HWLOC_UTILS_INPUT_XML;
|
||||
} else {
|
||||
fprintf (stderr, "Unrecognized input file: %s\n", input);
|
||||
usage (callname, stderr);
|
||||
}
|
||||
}
|
||||
|
||||
switch (input_format) {
|
||||
case HWLOC_UTILS_INPUT_XML:
|
||||
#ifdef HWLOC_HAVE_XML
|
||||
if (!strcmp(input, "-"))
|
||||
input = "/dev/stdin";
|
||||
if (hwloc_topology_set_xml(topology, input)) {
|
||||
perror("Setting target XML file");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#else /* HWLOC_HAVE_XML */
|
||||
fprintf(stderr, "This installation of hwloc does not support XML, sorry.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
#endif /* HWLOC_HAVE_XML */
|
||||
break;
|
||||
|
||||
case HWLOC_UTILS_INPUT_FSROOT:
|
||||
#ifdef HWLOC_LINUX_SYS
|
||||
if (hwloc_topology_set_fsroot(topology, input)) {
|
||||
perror("Setting target filesystem root");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#else /* HWLOC_LINUX_SYS */
|
||||
fprintf(stderr, "This installation of hwloc does not support changing the file-system root, sorry.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
#endif /* HWLOC_LINUX_SYS */
|
||||
break;
|
||||
|
||||
case HWLOC_UTILS_INPUT_SYNTHETIC:
|
||||
if (hwloc_topology_set_synthetic(topology, input))
|
||||
return EXIT_FAILURE;
|
||||
break;
|
||||
|
||||
case HWLOC_UTILS_INPUT_DEFAULT:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user