affinity

assign two MPI processes per core

有些话、适合烂在心里 提交于 2019-11-27 09:08:41
How do I assign 2 MPI processes per core? For example, if I do mpirun -np 4 ./application then it should use 2 physical cores to run 4 MPI processes (2 processes per core). I am using Open MPI 1.6. I did mpirun -np 4 -nc 2 ./application but wasn't able to run it. It complains mpirun was unable to launch the specified application as it could not find an executable: Hristo Iliev orterun (the Open MPI SPMD/MPMD launcher; mpirun/mpiexec are just symlinks to it) has some support for process binding but it is not flexible enough to allow you to bind two processes per core. You can try with -bycore

Activity跳转Flag详解

自古美人都是妖i 提交于 2019-11-27 07:45:03
Android 的一个特色就是 application A 的 activity 可以启动 application B 的 activity,尽管 A 和 B 是毫无干系的,而在用户看来,两个场景紧密联系,视觉上二者构成了一个整体。Android 就是把这种误觉定义为 Task,它既不是 class,也不是 AndroidMainifest.xml 中的一个元素。从表现上看 Task 就像是一个 stack,一个一个的 activity 是构成 stack 的元素,做着入栈 (push) 和出栈 (pop-up)这样简单重复性的劳动。 默认的规则总是满足大多数的应用场景,但是也总会有一些例外打破习以为常的惯例。Task 的默认规则同样并非牢不可破,修改的方法还是有的。借助 Intent 中的 flag 和 AndroidMainifest.xml 中 activity 元素的属性,就可以控制到 Task 里 Activity 的关联关系和行为。 在 android.content.Intent 中一共定义了20种不同的 flag,其中和 Task 紧密关联的有四种: 1.FLAG_ACTIVITY_NEW_TASK 2.FLAG_ACTIVITY_CLEAR_TOP 3.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED 4.FLAG_ACTIVITY

How to prevent inheriting CPU affinity by child forked process?

ⅰ亾dé卋堺 提交于 2019-11-27 06:56:09
问题 I have a server process that forks many child processes. The server process has affinity to a CPU core, but I don't want that affinity to be inherited by child process (rather OS should handle where to run these processes). Is there a way to delink parent child processes with respect to cpu affinity? 回答1: You can call sched_setaffinity(2) with all bits set in CPU mask after the fork(2) and before the execve(2). 来源: https://stackoverflow.com/questions/8336191/how-to-prevent-inheriting-cpu

What is the difference between pthread_self() and gettid()? Which one should I use?

隐身守侯 提交于 2019-11-27 01:32:37
问题 I'm trying to set the CPU affinity of threads on Linux. I'd like to know which one of the following approaches is recommended: Get thread id using pthread_self() Set CPU affinity using pthread_setaffinity_np(....) by passing the thread id as an argument Get thread id using the gettid() call Set CPU affinity using sched_setaffinity(....) by passing the thread id in the place of the process id P.S: After setting the CPU affinity, I intend to increase the scheduling priority of the thread. 回答1:

How to use sched_getaffinity and sched_setaffinity in Linux from C?

删除回忆录丶 提交于 2019-11-26 20:38:38
问题 I am trying to: Run 16 copies concurrently with processor pinning (2 copies per core) Run 8 copies concurrently with processor pinning (2 copies per core) and flipping processor core to the furthest core after certain function say function 1 finishes. The problem I am facing is how to select the farthest processor. Some friends suggested to use sched_getaffinity and sched_setaffinity but I count not find any good examples. 回答1: To use sched_setaffinity to make the current process run on core

How to set CPU affinity for a process from C or C++ in Linux?

馋奶兔 提交于 2019-11-26 18:51:55
Is there a programmatic method to set CPU affinity for a process in c/c++ for the Linux operating system. You need to use sched_setaffinity(2) . For example, to run on CPUs 0 and 2 only: #define _GNU_SOURCE #include <sched.h> cpu_set_t mask; CPU_ZERO(&mask); CPU_SET(0, &mask); CPU_SET(2, &mask); result = sched_setaffinity(0, sizeof(mask), &mask); ( 0 for the first parameter means the current process, supply a PID if it's some other process you want to control). See also sched_getcpu(3) . Use sched_setaffinity at the process level, or pthread_attr_setaffinity_np for individual threads. In short

how to set CPU affinity of a particular pthread?

心已入冬 提交于 2019-11-26 14:57:49
I'd like to specify the cpu-affinity of a particular pthread. All the references I've found so far deal with setting the cpu-affinity of a process (pid_t) not a thread (pthread_t). I tried some experiments passing pthread_t's around and as expected they fail. Am I trying to do something impossible? If not, can you send a pointer please? Thanks a million. This is a wrapper I've made to make my life easier. Its effect is that the calling thread gets "stuck" to the core with id core_id : // core_id = 0, 1, ... n-1, where n is the system's number of cores int stick_this_thread_to_core(int core_id)

assign two MPI processes per core

自古美人都是妖i 提交于 2019-11-26 14:31:48
问题 How do I assign 2 MPI processes per core? For example, if I do mpirun -np 4 ./application then it should use 2 physical cores to run 4 MPI processes (2 processes per core). I am using Open MPI 1.6. I did mpirun -np 4 -nc 2 ./application but wasn't able to run it. It complains mpirun was unable to launch the specified application as it could not find an executable: 回答1: orterun (the Open MPI SPMD/MPMD launcher; mpirun/mpiexec are just symlinks to it) has some support for process binding but it

kubernetes高级调度方式

…衆ロ難τιáo~ 提交于 2019-11-26 12:28:52
调度方式: 节点选择器: nodeSelector,nodeName 节点亲和调度: nodeAffinity pod亲和调度: podAffinity ♦ kubectl get nodes --show-labels 可以查看节点存在哪些标签 一、节点选择器 ♦ nodeSelector选择的标签需要在node上存在,node才会被选中为pod创建的节点 下图中pod使用了nodeSelector选项过滤包含了gup=9527标签的node,然后pod就创建到了ks-node2上: 二、节点亲和调度 ♦ pod.spec.affinity.nodeAffinity.preferredDuringSchedulingIgnoredDuringExecution 软亲和性,尽量找满足需求的 apiVersion: v1 kind: Pod metadata: name: pod-node-preferaffinity #namespace: develop labels: app: ngx-demo rel: stable spec: containers: - image: nginx imagePullPolicy: IfNotPresent name: nginx-node-preferaffinity affinity: nodeAffinity:

How to set CPU affinity for a process from C or C++ in Linux?

▼魔方 西西 提交于 2019-11-26 06:01:24
问题 Is there a programmatic method to set CPU affinity for a process in c/c++ for the Linux operating system. 回答1: You need to use sched_setaffinity(2). For example, to run on CPUs 0 and 2 only: #define _GNU_SOURCE #include <sched.h> cpu_set_t mask; CPU_ZERO(&mask); CPU_SET(0, &mask); CPU_SET(2, &mask); result = sched_setaffinity(0, sizeof(mask), &mask); ( 0 for the first parameter means the current process, supply a PID if it's some other process you want to control). See also sched_getcpu(3).