[erlang-questions] performance on multicore computer

Jiansen He <>
Sun Oct 24 19:48:09 CEST 2010


Thank you, Jesper. my new code is as follows:

%% -- generate all sequences of length exactly n starting at index i or
later
%% gen_ :: Int -> Int -> [String] -> AssocList [String] Int
gen_ (_, _, []) -> [];
gen_ (I, N, [H | T]) ->
 if
    N > length([H | T]) -> [];
    true ->
       insert({takeN(N, [H | T]), I}, gen_ (I+1, N, T))
 end.

%% -- generate all sequences of length at most n
%% gen :: Int -> [String] -> AssocList [String] Int
gen(0, _) ->
    [];
gen(N, L) ->
    [Sqs_len_n, Sqs_up_to_n1] = rpc:parallel_eval([concordance_1_1_2, gen_,
[0, N, L], concordance_1_1_2, gen, [(N-1), L]]),
    io:format("~p",[Sqs_len_n]).



However, when I run this code, I got following error message:

exception error: no function clause matching
                    rpc:map_nodes([concordance_1_1_2,gen_,
                                   [0,2,
                                    ["the","manchester","marriage",

"elizabeth","gaskell","mrs","openshaws",
                                     "christian","name","was","alice","and",
                                     "her","first","husband","had","been",
                                     "her","own","cousin","she",
                                     [...]|...]],
                                   concordance_1_1_2,gen,
                                   [1,
                                    ["the","manchester","marriage",

"elizabeth","gaskell","mrs","openshaws",
                                     "christian","name","was","alice","and",
                                     "her","first","husband","had","been",
                                     "her","own",
                                     [...]|...]]],
                                  [],
                                  [])
     in function  rpc:parallel_eval/1
     in call from concordance_1_1_2:gen/2
     in call from concordance_1_1_2:concordance/2
     in call from concordance_1_1_2:main/2


Can I use rpc:parallel_eval/1 on one machine only.  In this program, I'm
interested in how to utilize a multi-core machine,
although rpc:parallel_eval/1 is definitely a useful machine for cluster
computing.

I tried net_adm:ping(), and it give me pang.  nodes() returns
[].


More information about the erlang-questions mailing list