[erlang-questions] How to compiler Erlang for the TILEPro64?

Björn-Egil Dahlberg egil@REDACTED
Fri Jan 29 17:49:59 CET 2010

Stefan Marr wrote:
> Hi Björn-Egil:
> Thanks a lot, worked great!

Great to hear! =)

> Here some notes, about things I had "trouble" with.
> The SKIP files seem to be deleted by the configure step, thus I had to recreate them afterwards. Otherwise I get linker errors, since the tile-gcc tried to link some IA32 files. Think it was complaining about crypto.a or something similar.

Yes, this is unfortunate and a bug. The boostrap configure step is done 
after the tile-configuration and thus removes the skip-files in the 
setup step. This worked in R13B02-1, probably because of another bug in 
configure or otp_build.

These bugs will not, per se, be corrected. The whole cross compile build 
step is redone to r13b04.

> For the release step, I also had to do a "touch lib/mnesia/SKIP" for some reason, I haven't investigated further.

Ok, when testing it here it works.

> It is also good to know, that <release dir> has to be an absolute path :)

Right. I think this will also be addressed in r13b04.

> Afterwards, you can have a very happy helloworld with
> tile-monitor --pci --here -- bin/erl -noshell -s hello_world start -s init stop

> I have not yet looked anywhere into the actual support provided for the Tilera chips, but is there something like printing the core id the process is running on?
> Are there any parameters to erl to specify how many hardware cores to use?

Yes. There are several settings you can specify.
Firstly you can specify how many schedulers you want to use, this is 
done via +S switch.

Secondly if you want to bind schedulers to tile cores you need to set a 
cpu topology which corresponds to the actual topology on your card (if 
it is not detected automatically). This can be done from erlang or on 
the command line using the +sct switch.

Please read,

To bind schedulers use command line switch +sbt db for instance.
Further reading,

Putting it all together.

An example,

... upload-tile setup things ...

$TILERA_ROOT/bin/tile-monitor --pci-resume \
   --upload otp /tmp/otp \
   --upload tests /tmp/tests \

tile_erl="$TILERA_ROOT/bin/tile-monitor --pci-resume --tunnel 2023 23 \
     --env HOME=/tmp \
     --cd /tmp/tests \
     --tiles - all ^0 - -- /tmp/otp/bin/erl"

Using 58 schedulers ...

$tile_erl +sct L10-18,1-9,19-55,57,58,61c1-55,57,58,61 +sbt db \
         +S 58 \
         -s run_test test1 \
         -s init stop

I cannot guarantee that this will work on your card though. But 
hopefully you can get some useful information from this.


> On 29 Jan 2010, at 15:45, Björn-Egil Dahlberg wrote:
>> Hi Stefan,
>> To compile Erlang for Tilera you can do the following,
>> 1) Setup the Tilera Environment.
>> For example for me it is:
>> export TILERA_ROOT=/ldisk/tilera/TileraMDE-
>> export PATH=$TILERA_ROOT/bin:$PATH
>> This is the cross compile environment supplied to you by Tilera Corp.
>> 2) Setup The Erlang Build Environment:
>> tar -zxvf otp_src_R13B03.tar.gz
>> cd otp_src_R13B03
>> export ERL_TOP=`pwd`
>> eval `./otp_build env_cross
>> $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf`
>> Crypto (and its dependencies) will not work so you need to SKIP those.
>> 3) Build Erlang/OTP
>> touch lib/crypto/SKIP
>> touch lib/ssl/SKIP
>> touch lib/ssh/SKIP
>> ./otp_build configure
>> ./otp_build boot -a
>> ./otp_build release -a <release dir>
>> 4) Start Erlang,
>> cd <release dir>
>> ./Install `pwd`
>> tile-monitor --pci --here -- bin/erl
>> Of course you would probably want to upload everything to the card, just
>> like other applications you need to upload.
>> Contact Tilera Corp. for optimal settings and hardware configuration.
>> This should work on R13B03. However, from R13B04 this way will change
>> and it will be better support cross compilation.
>> Regards,
>> Björn-Egil
>> Erlang/OTP
>> Stefan Marr wrote:
>>> Hi:
>>> I have tried to compile Erlang (otp_src_R13B03) for the TILEPro64.
>>> I was starting from the following bits of information:
>>> http://www.erlang.org/cgi-bin/ezmlm-cgi/4/44766
>>> http://www.trapexit.org/Cross_compiling
>>> When I tried to execute: ./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf
>>> I got an error asking me to do a
>>> "eval `./otp_build env_cross $ERL_TOP/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf`" instead, but this command didn't generate any output.
>>> The wiki article on the other hand, asks me to choose a target "TARGET=mips-linux" and I am not sure where to find out the right target.
>>> Would be great, if someone could point me at some documentation, or could give me advice on how to compile Erlang for the Tilera card.
>>> Many thanks and best regards
>>> Stefan

More information about the erlang-questions mailing list