Tuesday, September 11, 2007

Enabling SMP Support for Erlang on Mac OS X

If you are working with Erlang on Mac OS X and have installed it via Mac Ports, then you might not be running the SMP enabled erlang.

To check, start erlang as


erlang -smp


If you get:


Argument '-smp' not supported.


Then your erlang was not compiled with SMP. All you'll need to do is:


sudo port uninstall erlang
sudo port install erlang +smp


Then when you run erlang -smp, you'll be dropped right into the erlang shell. When you run anything with multiple processes, you'll see both of your CPU cores active.

2 comments:

Brian said...

Interestingly, I installed Erlang 12B-0 with the smp variant from Macports yesterday. The simple command "erl" actually starts the shell with the smp option. To make it use only one processor, it's necessary to start it like this: "erl -smp disable".

Brian said...

Interestingly, I installed Erlang 12B-0 with the smp variant from Macports yesterday. The simple command "erl" actually starts the shell with the smp option. To make it use only one processor, it's necessary to start it like this: "erl -smp disable".