[18335fall08] disabling multiprocessing in Matlab for problem 3

Steven G. Johnson stevenj.mit at gmail.com
Sat Sep 13 16:16:25 EDT 2008


Hi gang,

One of you brought to my attention that Matlab may automatically  
parallelize its matrix-multiply routine if you have a multi-core  
machine (which most people do nowadays).  This may lead to distorted  
or confusing results in problem 3 of the pset.

You can turn off multiprocessing in Matlab by using the  
maxNumCompThreads function.  In particular, doing

	maxNumCompThreads(1)

should tell Matlab to use at most one processor.  (Note that you have  
to do this each time you run Matlab, as when you launch it  
automatically uses all available processors by default.)

(Other odd things can happen during benchmarking too. A colleague of  
mine recently pointed out some very weird behavior that can occur on  
laptops, especially under Windows, due to thermal management -- when  
the processor runs at full speed, it gets too hot and the system  
automatically slows it down.  So, if you get weird inconsistent  
results on a laptop, you might want to switch to a desktop, as desktop  
machines are usually better cooled.)

--SGJ



More information about the 18335fall08 mailing list