zeam-vm / pelemay

Pelemay is a native compiler for Elixir, which generates SIMD instructions. It has a plan to generate for GPU code.
Apache License 2.0
186 stars 13 forks source link

Testing Pelemay on various processor architectures #63

Open zacky1972 opened 5 years ago

zacky1972 commented 5 years ago

Current Pelemay is tested on x86_64 architectures (Intel and AMD), though is not tested well on other platforms including IA-32, ARM, MIPS and so on, which are supported by Erlang VM.

Unfortunately, we don't have enough PCs, embedded and IoT systems, which have such above-mentioned architectures...

Thus, I'll ask YOU to test Pelemay on various processor architectures.

Testing is easy:

  1. Set up your system.
  2. Install Erlang, Elixir and Clang
  3. mix new test.
  4. cd test.
  5. Edit deps in mix.exs:
def deps do
  [
    {:pelemay, "~> 0.0"},
  ]
end
  1. mix deps.get
  2. Write lib/test.ex:
defmodule Test do
  require Pelemay
  import Pelemay

  defpelemay do
    def enum_square list do
       list |> Enum.map(& &1 * &1)
    end
  end

  @doc """
    ## Examples
    iex> Test.do_test()
    [1, 4, 9, 16]
  """
  def do_test do
    1..4 |> Enum.to_list |> enum_square()
  end
end
  1. Modify test/test_test.exs into:
defmodule TestTest do
  use ExUnit.Case, async: true
  doctest Test
end
  1. mix test
  2. Write a bug report in the manner of our issue templates, if you got some errors. Please describe information on your platform in details.
  3. Report your platform on which the testing succeed on this issue.
zacky1972 commented 5 years ago

I recieved some comments and questions on the scope of the target. Thank you!

The target architectures are supported architecture of Erlang and Clang.

I got Erlang supports architectures according to the following script:

https://github.com/erlang/otp/blob/master/erts/autoconf/config.guess

And, Clang supports architectures according to the following document:

http://llvm.org/doxygen/Triple_8h_source.html

Thus, we can get potential supported architectures of Pelemay, by applying AND operation to them. This work will be some troublesome...

So, we also ask you to help this enumeration.

zacky1972 commented 5 years ago

I'd also discuss candidates of supported architectures with YOU. If you ask us to support some architectures, we'd like to try to do so.

fhunleth commented 5 years ago

Raspberry Pi 4 running Raspbian appears to work:

$ sudo apt install elixir erlang clang
$ mix deps.get
$ mix test
.

Finished in 0.1 seconds
1 doctest, 0 failures

Randomized with seed 521758
$ iex -S mix
Erlang/OTP 21 [erts-10.2.4] [source] [smp:4:4] [ds:4:4:10] [async-threads:1]

Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Test.do_test
[1, 4, 9, 16]
iex(2)>

The Raspberry Pi installs Elixir 1.7.4 when going through apt. This causes a compiler warning since Pelemay's mix.exs says that it requires Elixir 1.9, but it seems to work just fine.

Raspbian runs the Raspberry Pi 4's ARM in 32-bit mode.

dimitarvp commented 5 years ago

Worked okay, no errors.

CPU:

Intel(R) Xeon(R) W-2150B CPU @ 3.00GHz

Processor information page (sorry, no official one from Intel; the processor was specially built for the iMac Pro and for some reason is not listed on the Intel website): https://en.wikichip.org/wiki/intel/xeon_w/w-2150b

Advice: try and collect a series of commands for Windows / Linux / macOS so people can run them and give you well-formatted system specs.

zacky1972 commented 5 years ago

Thank you for your contribute @fhunleth @dimitarvp

Your information assure me that the software architecture of Pelemay works well on non-tested architectures like ARM.

And thank you for your advice @dimitarvp I'll provide well-tested installation and testing instruction ASAP.

abe-tatsuya commented 4 years ago

Ultra96-V2上で行いました。clangのwarningが出ていますが、動作自体はできているのではないかと思います。

` Compiling 1 file (.ex) clang: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument] Generated test app .

Finished in 0.1 seconds 1 doctest, 0 failures

Randomized with seed 686420 fpga@ubuntu-fpga:~/test$ iex -S mix Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [kernel-poll:false]

==> pelemay Compiling 8 files (.ex) Generated pelemay app ==> test Compiling 1 file (.ex) clang: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument] clang: warning: argument unused during compilation: '-undefined dynamic_lookup' [-Wunused-command-line-argument] Generated test app Interactive Elixir (1.9.2) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> Test.do_test [1, 4, 9, 16] iex(2)>
`