multicore

How to optimize the following code with nested while-loop? Multicore an option?

和自甴很熟 提交于 2019-11-28 10:37:45
I am having a challenge with a piece of code that takes very long to execute and I am wondering what are the key tricks to optimize the execution time of this code. I have to admit that the input data.frame is significant (140,000 rows) and that the output data.frame is approximately 220,000 rows. A sample of the input data.frame: head(extremes) X_BusinessIDDescription min max month ID105 2007-12-01 2008-06-01 2007-12-01 ID206 2007-12-01 2009-07-01 2007-12-01 ID204 2007-12-01 2008-02-01 2007-12-01 ID785 2008-07-01 2010-08-01 2008-07-01 ID125 2007-11-01 2008-07-01 2007-11-01 ID107 2007-11-01

How to run code on every CPU

主宰稳场 提交于 2019-11-28 10:19:51
问题 I am trying to set the Performance Monitor User Mode Enable register on all cpus on a Nexus 4 running a mako kernel. Right now I am setting the registers in a loadable module: void enable_registers(void* info) { unsigned int set = 1; /* enable user-mode access to the performance counter*/ asm volatile ("mcr p15, 0, %0, c9, c14, 0\n\t" : : "r" (set)); } int init_module(void) { online = num_online_cpus(); possible = num_possible_cpus(); present = num_present_cpus(); printk (KERN_INFO "Online

Get GNU Octave to work with a multicore processor. (Multithreading)

你离开我真会死。 提交于 2019-11-28 09:43:51
I want to be able to program multiple threads with gnu octave so it will utilize multiple processors. I installed GNU Octave on Fedora 17 Linux and did the following: yum install octave Which installed on my computer the latest version of octave, 3.6.2. It works great, however when you multiply two huge matrices together it bogs down the one CPU that octave uses. It would be nice if the matrix multiplication utilizes all of the cores, since in this case the CPU is obviously the bottleneck. Can octave fully utilize multi-core processors and run on multiple threads? Is there a library or compile

How does sched_setaffinity() work?

霸气de小男生 提交于 2019-11-28 07:00:05
I am trying to understand how the linux syscall sched_setaffinity() works. This is a follow-on from my question here . I have this guide , which explains how to use the syscall and has a pretty neat (working!) example. So I downloaded the Linux 2.6.27.19 kernel sources . I did a 'grep' for lines containing that syscall, and I got 91 results. Not promising. Ultimately, I'm trying to understand how the kernel is able to set the instruction pointer for a specific core (or processor.) I am familiar with how single-core-single-thread programs work. One might issue a 'jmp foo' instruction, and this

could not find function inside foreach loop

不想你离开。 提交于 2019-11-28 06:27:17
I'm trying to use foreach to do multicore computing in R. A <-function(....) { foreach(i=1:10) %dopar% { B() } } then I call function A in the console. The problem is I'm calling a function Posdef inside B that is defined in another script file which I source. I had to put Posdef in the list of export argument of foreach : .export=c("Posdef") . However I get the following error: Error in { : task 3 failed - "could not find function "Posdef"" Why cant R find this defined function? The short answer is that this was a bug in parallel backends such as doSNOW , doParallel and doMPI , but it has

Functional programming and multicore architecture

ⅰ亾dé卋堺 提交于 2019-11-28 05:29:11
I've read somewhere that functional programming is suitable to take advantage of multi-core trend in computing. I didn't really get the idea. Is it related to the lambda calculus and von neumann architecture? Functional programming minimizes or eliminates side effects and thus is better suited to distributed programming. i.e. multicore processing. In other words, lots of pieces of the puzzle can be solved independently on separate cores simultaneously without having to worry about one operation affecting another nearly as much as you would in other programming styles. One of the hardest things

Does java code automatically utilize multiple processor cores if available

夙愿已清 提交于 2019-11-28 04:58:13
问题 If multiple cores are available on a given processor, will they be utilized automatically when JVM runs a java code written by user? Or the code will have to be specifically written to take advantage of multi-core? I mean, do we have to create the code any differently for JVM to be able to take advantage of multiple cores while running it, say by means of the programmer creating multiple threads in the user code? And say if we don't use multi-threading in the java code, JVM won't be able to

How do interrupts in multicore/multicpu machines work?

六眼飞鱼酱① 提交于 2019-11-28 04:24:23
I recently started diving into low level OS programming. I am (very slowly) currently working through two older books, XINU and Build Your Own 32 Bit OS, as well as some resources suggested by the fine SO folks in my previous question, How to get started in operating system development . It could just be that I haven't encountered it in any of those resources yet, but its probably because most of these resources were written before ubiquitous multicore systems, but what I'm wondering is how interrupts work in a multicore/multiprocessor system. For instance, say the DMA wants to signal that a

Python: Multicore processing?

坚强是说给别人听的谎言 提交于 2019-11-28 03:59:27
I've been reading about Python's multiprocessing module . I still don't think I have a very good understanding of what it can do. Let's say I have a quadcore processor and I have a list with 1,000,000 integers and I want the sum of all the integers. I could simply do: list_sum = sum(my_list) But this only sends it to one core. Is it possible, using the multiprocessing module, to divide the array up and have each core get the sum of it's part and return the value so the total sum may be computed? Something like: core1_sum = sum(my_list[0:500000]) #goes to core 1 core2_sum = sum(my_list[500001

How do SMP cores, processes, and threads work together exactly?

半腔热情 提交于 2019-11-28 03:06:11
On a single core CPU, each process runs in the OS, and the CPU jumps around from one process to another to best utilize itself. A process can have many threads, in which case the CPU runs through these threads when it is running on the respective process. Now, on a multiple core CPU: Do the cores run in every process together, or can the cores run separately in different processes at one particular point of time? For instance, you have program A running two threads. Can a dual core CPU run both threads of this program? I think the answer should be yes if we are using something like OpenMP .