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

mix pelemay.bench occurs an error on the host of Nerves #131

Open zacky1972 opened 4 years ago

zacky1972 commented 4 years ago

Describe the bug mix pelemay.bench occurs an error on the host of Nerves

To Reproduce Steps to reproduce the behavior:

  1. mix new np_sample
  2. Install Pelemay 0.0.11 in mix.exs and mix deps.get
  3. Use Pelemay in the source code
defmodule NpSample do
  require Pelemay
  import Pelemay

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

  def hello do
    :world
  end
end
  1. export MIX_TARGET=rpi3
  2. mix pelemay.bench NpSample
  3. see error:
** (UndefinedFunctionError) function PelemayNifElixirNpSample.bench/0 is undefined (module PelemayNifElixirNpSample is not available)
    (np_sample 0.1.0) PelemayNifElixirNpSample.bench()
    (stdlib 3.12) erl_eval.erl:680: :erl_eval.do_apply/6
    (stdlib 3.12) erl_eval.erl:888: :erl_eval.expr_list/6
    (stdlib 3.12) erl_eval.erl:411: :erl_eval.expr/5
    (elixir 1.10.0) lib/code.ex:332: Code.eval_string_with_error_handling/3
    (elixir 1.10.0) lib/enum.ex:783: Enum."-each/2-lists^foreach/1-0-"/2

Expected behavior Run a benchmark

Screenshots None

Desktop (please complete the following information):

> CpuInfo.all_profile
%{
  compiler: %{
    apple_clang: [
      %{
        bin: "/usr/bin/clang",
        type: :apple_clang,
        version: "11.0.0",
        versions: "Apple clang version 11.0.0 (clang-1100.0.33.17)"
      }
    ],
    "apple_clang++": [
      %{
        bin: "/usr/bin/clang++",
        type: :"apple_clang++",
        version: "11.0.0",
        versions: "Apple clang version 11.0.0 (clang-1100.0.33.17)"
      }
    ],
    cc_env: [],
    cflags_env: "-I/usr/local/opt/llvm/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/mysql@5.6/include -I/usr/local/opt/openblas/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/icu4c/include -I/usr/local/opt/lapack/include",
    clang: [
      %{
        bin: "/usr/local/opt/llvm/bin/clang",
        type: :clang,
        version: "9.0.0",
        versions: "clang version 9.0.0 (tags/RELEASE_900/final)"
      },
      %{
        bin: "/usr/local/opt/llvm/bin/clang-9",
        type: :clang,
        version: "9.0.0",
        versions: "clang version 9.0.0 (tags/RELEASE_900/final)"
      }
    ],
    "clang++": [
      %{
        bin: "/usr/local/opt/llvm/bin/clang++",
        type: :"clang++",
        version: "9.0.0",
        versions: "clang version 9.0.0 (tags/RELEASE_900/final)"
      }
    ],
    cxx_env: [],
    cxxflags_env: "",
    "g++": [
      %{
        bin: "/usr/bin/g++",
        type: :"apple_clang++",
        version: "11.0.0",
        versions: "Apple clang version 11.0.0 (clang-1100.0.33.17)"
      },
      %{
        bin: "/usr/local/bin/g++-7",
        type: :"g++",
        version: "7.5.0",
        versions: "g++-7 (Homebrew GCC 7.5.0_1) 7.5.0"
      },
      %{
        bin: "/usr/local/bin/g++-8",
        type: :"g++",
        version: "8.3.0",
        versions: "g++-8 (Homebrew GCC 8.3.0_2) 8.3.0"
      },
      %{
        bin: "/usr/local/bin/g++-9",
        type: :"g++",
        version: "9.3.0",
        versions: "g++-9 (Homebrew GCC 9.3.0_1) 9.3.0"
      }
    ],
    gcc: [
      %{
        bin: "/usr/bin/gcc",
        type: :apple_clang,
        version: "11.0.0",
        versions: "Apple clang version 11.0.0 (clang-1100.0.33.17)"
      },
      %{
        bin: "/usr/local/bin/gcc-7",
        type: :gcc,
        version: "7.5.0", 
        versions: "gcc-7 (Homebrew GCC 7.5.0_1) 7.5.0"
      },
      %{
        bin: "/usr/local/bin/gcc-8",
        type: :gcc,
        version: "8.3.0",
        versions: "gcc-8 (Homebrew GCC 8.3.0_2) 8.3.0"
      },
      %{
        bin: "/usr/local/bin/gcc-9",
        type: :gcc,
        version: "9.3.0",
        versions: "gcc-9 (Homebrew GCC 9.3.0_1) 9.3.0"
      }
    ],
    ldflags_env: "-L/usr/local/opt/llvm/lib -L/usr/local/opt/sqlite/lib -L/usr/local/opt/mysql@5.6/lib -L/usr/local/opt/openblas/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/icu4c/lib -L/usr/local/opt/lapack/lib"
  },
  cpu: %{
    cpu_model: "Intel Xeon W",
    cpu_models: ["Intel Xeon W"],
    cpu_type: "x86_64",
    hyper_threading: :enabled,
    num_of_cores_of_a_processor: 18,
    num_of_processors: 1,
    num_of_threads_of_a_processor: 36,
    os_type: :macos,
    total_num_of_cores: 18,
    total_num_of_threads: 36
  },
  cuda: %{cuda: false},
  elixir: %{version: "1.10.0"},
  erlang: %{otp_version: 22},
  kernel: %{
    kernel_release: "18.7.0",
    kernel_version: "Darwin 18.7.0",
    system_version: "macOS 10.14.6 (18G4032)"
  },
  metal: %{metal: true}
} 

Additional context None.