How Can I Run a Process to a specific physical core using OpenMPI? - openmpi

How Can I Run a Process to a specific physical core without using processor affinity or other virtual techniques only using OpenMPI in my intel core i5 processor?

Related

What role do QEMU and KVM play in virtual machine I/O?

I find the boundary between QEMU and KVM very blurred. I find that someone says a virtual machine is a qemu process while others say a kvm process. What is it exactly?
And what role does QEMU and KVM plays in virtual machine I/O? For example, when a vm does PIO/MMIO, is it qemu or kvm that will trap it and turns it to hardware operation. Or both are responsible?
KVM: the code in the Linux kernel which provides a friendly interface to userspace for using the CPU virtualization. This includes functions that userspace can call for "create CPU", "run CPU", etc. For a full virtual machine, you need to have some userspace code which can use this. This is usually either QEMU, or the simpler "kvmtool"; some large cloud providers have their own custom userspace code instead.
QEMU: emulates a virtual piece of hardware, including disks, memory, CPUs, serial port, graphics, and other devices. Also provides mechanisms (a UI, and some programmable interfaces) for doing things like starting, stopping, and migrating. QEMU supports several different 'accelerator' modes for how it handles the CPU emulation:
TCG: pure emulation -- works anywhere, but very slow
KVM: uses the Linux kernel's KVM APIs to allow running guest code using host CPU hardware virtualization support
hax: similar to KVM, but using the Intel HAXM code, which will work on Windows hosts
From an implementation point of view the boundary between KVM and QEMU is very clear -- KVM is a part of the host kernel, whereas QEMU is a separate userspace program. For a user, you typically don't have to care where the boundary is, because that's an implementation detail.
To answer your question about what happens for MMIO:
the guest makes an MMIO access
this is trapped to the host kernel by the hardware
the host kernel (KVM) might then emulate this MMIO access itself, because a few devices are implemented in the kernel for performance reasons. This usually applies only to the interrupt controller and perhaps the iommu.
otherwise, KVM reports the MMIO access back to userspace (ie to QEMU, kvmtool, etc)
userspace then can handle the access, using its device emulation code
userspace then returns the result (eg the data to return for a read) to the kernel
the kernel updates the vcpu's register state as required to complete emulation of the instruction
the kernel then resumes execution of the VM at the following instruction

U-boot to load two kernel (GPOS and RTOS) on separate CPU (A9 and M3)

I have pandaboard omap4460 development board. My project needs to flash two OS kernels (GPOS and NuttX RTOS) in such a way that linux runs on Cortex-A9 and RTOS on Cortex-M3. I have 1GB LPDDR2 in which I have to allocate first 128MB for RTOS and rest for LINUX image.
How to configure U-boot in this case?
Please let me know some steps if anyone have solved this!

It is possible to combine Linux (one core) and bare-bone firmware (second core) on one dual core computer?

I was checking project Embedded ECG data acquisition system from instructables and there is mension a TODO:
Combining the OS and bare-bone firmware
UNDER CONSTRUCTION
** Since the bootloader only loads one firmware to the Core,
I need to modify the ELF file, to have Linux and bare-bone Core at the same time **
It seems to me as interresting approach how to make full featured Linux and critical realtime OS on one board (for example Raspberry PI). It is really possible? I have heard, that Linux can be setup to not use some cores. But I suppose that Linux use virtual memory and bare-bone firmware does usually not. Can the memory be shared between these OS. What about interruptions? Can these two OS handle interruptions separately? Can boot loader load these two systems to both core at once? I can imagine that one thread in boot loader will skip to address of bare-bone OS. It is correct approach?
Yes, it is possible, even if the full setup is not straightforward.
A couple of examples:
Xilinx released a white paper explaining how to run Linux + FreeRTOS on a dual-core Zynq ARM
Evidence explained how to run Linux + Erika Enterprise RTOS on a dual-core Freescale imx6 ARM
Those examples are based on system partitioning by hard-coding the assignment of the different cores to different OSs.
If your system is capable of hardware-assisted virtualization, you can use an hypervisor for making (and enforcing) such partitioning. You can for example use Siemen's Jailhouse, KVM or Xen.
Kind of. This is what people already do to some extent with network stack / driver. For example IsoStack idea works in a similar way. There's a project which actually implements this on linux by dedicating cores to network cards, but my google-fu is failing me.

On which CPU processor is OpenCL kernel running

I want to determine exactly how AMD schedules its OpenCL kernels on the CPU and I could not find any OpenCL function to determine the physical processor/core id on which it is running.
I could only find the following links related to my problem:
Getting the machine serial number and CPU ID using C/C++ in Linux
How to know on which physical processor and on which physical core my code is running
NUMA Get Current Node/Core
I tried the above but none of the solutions worked. I saw that OpenCL kernels do not support C99 headers like stddef.h which is required for sched.h or even fopen().
Is there any way I can see exactly how the openCL kernels have been assigned to each CPU core/processor?
Note: I am using Ubuntu 14.04, gcc version 4.8.2 and AMD APP SDK 3.0.
Thanks for your help!

How to find the thread affinity in Linux other than using the affinity mask?

We have an embedded MIPS 2-core processor running SMP Linux (2.6.18).
We are planning to assign the affinity of the main GUI threads to one of the two cores, and the other core used for driver/data path processing.
However, the questions has been asked of how do you tell which threads are on which core?
I can get the affinity mask fine, but is there any other way of telling (e.g. /proc system) which threads are on which core?
Thanks.
sched_getcpu - determine CPU on which the calling thread is running
man sched_getcpu()

Resources