簡體   English   中英

如何更改Erlang Makefile,使其啟用SMP模式?

[英]How can I change the Erlang makefile so that it enables the SMP mode?

我想開發一個需要SMP的應用程序。 但是在我正在使用的Erlang makefile中,這些選項是在非smp模式下設置的。 因此,當我啟動應用程序時,在Shell中收到一個錯誤,指示需要SMP仿真器,並且我應該從erl -smp開始。 如何更改Erlang Makefile,使其啟用SMP模式?
PS:erl -smp命令可在命令提示符下使用,即當我不使用makefile時。

請注意,通常是默認的smp版本(在單核計算機上運行時除外,在這種情況下,您可能要強制使用它),並且實際上,非smp版本將從代碼庫中刪除,開始於在下一個主要版本(OTP 21)中-您仍然可以在單核計算機上運行,​​但是該代碼不適用於單核計算機。 (這大大簡化了模擬器代碼,刪除了一大堆#ifdefs。)

不知道makefile的確切解決方案,但這可能會有所幫助

# Makefile

.PHONY: all compile run

REBAR=./rebar3

all: compile

compile:
    $(REBAR) compile

run: compile
        erl -pa _build/default/lib/*/ebin -config config/sys.config -args_file config/vm.args -boot start_sasl -s sync -s yourawesomeapp

對於我來說,我總是將vm.args文件與rebar3一起rebar3

這是代碼示例

## Name of the node
-name node@10.00.0.00

## Cookie for distributed erlang
-setcookie test_cookie

## Enable kernel poll and a few async threads
+K true
+A 2

## Force the erlang VM to use SMP
-smp enable

## Increase number of concurrent ports/sockets
-env ERL_MAX_PORTS 65535

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM