DeepHoldem icon indicating copy to clipboard operation
DeepHoldem copied to clipboard

scatterAdd not working

Open matthiasanderer opened this issue 6 years ago • 14 comments

Somehow I do not get the scatterAdd solution to work:

I got torch from: git clone https://github.com/torch/distro.git ~/torch --recursive

then in the torch folder changed TensorMath.lua as described...

and installed via: TORCH_LUA_VERSION=LUA52 ./install.sh

(but installed cutorch via luarocks -> is that wrong?)

after all I get:

./Game/card_tools.lua:30: attempt to call method 'scatterAdd' (a nil value)

matthiasanderer avatar Jun 13 '18 20:06 matthiasanderer

@matthiasanderer I realized that the readme doesn't say you have to modify the TensorMath.lua for cutorch as well if you want to use GPU. I will update the readme.md when I have time

happypepper avatar Jun 14 '18 04:06 happypepper

same error:

./Game/card_tools.lua:30: attempt to call method 'scatterAdd' (a nil value) stack traceback: ./Game/card_tools.lua:30: in function 'get_possible_hands_mask' ./Game/Evaluation/evaluator.lua:137: in function <./Game/Evaluation/evaluator.lua:132> (...tail calls...) ./TerminalEquity/terminal_equity.lua:74: in function 'get_last_round_call_matrix' ./TerminalEquity/terminal_equity.lua:179: in function '_set_call_matrix' ./TerminalEquity/terminal_equity.lua:217: in function 'set_board' ./DataGeneration/data_generation.lua:58: in function 'generate_data_file' ./DataGeneration/data_generation.lua:24: in function 'generate_data' DataGeneration/main_data_generation.lua:14: in main chunk [C]: in function 'dofile' ...errr/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: in ?

lorrp1 avatar Jun 15 '18 16:06 lorrp1

I've updated the readme, let me know if you are still seeing the issue.

happypepper avatar Jun 16 '18 22:06 happypepper

this is what i get now: cd Source && th DataGeneration/main_data_generation.lua 4 /home/painkillerrr/torch/install/bin/luajit: .../painkillerrr/torch/install/share/lua/5.1/trepl/init.lua:389: .../painkillerrr/torch/install/share/lua/5.1/trepl/init.lua:389: .../painkillerrr/torch/install/share/lua/5.1/trepl/init.lua:389: .../painkillerrr/torch/install/share/lua/5.1/trepl/init.lua:389: .../painkillerrr/torch/install/share/lua/5.1/trepl/init.lua:389: not enough memory stack traceback: [C]: in function 'error' .../painkillerrr/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require' DataGeneration/main_data_generation.lua:12: in main chunk [C]: in function 'dofile' ...errr/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x004057a0

in torch/install/share/ there is 5.1 while i have installed 5.2: $ lua Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio

im going to reinstall lua, torch and cuda toolkit

lorrp1 avatar Jun 17 '18 09:06 lorrp1

i reinstalled everything, i copyed the file it gave me the same error ./Game/card_tools.lua:30: attempt to call method 'scatterAdd' (a nil value), then i run: TORCH_LUA_VERSION=LUA52 ./install.sh Prefix set to /home/painkillerrr/torch/install, another time and i get: /lua/5.1/trepl/init.lua:389: not enough memory

lorrp1 avatar Jun 17 '18 14:06 lorrp1

If you are seeing not enough memory, it means you are using luajit.

make sure to run ./clean.sh before ./install.sh

Also, when you run the install.sh command, make sure you see this line: Installing Lua version: LUA52

happypepper avatar Jun 17 '18 18:06 happypepper

still the same error

very sad since its the only stuff id like to try

lorrp1 avatar Jun 17 '18 18:06 lorrp1

do you have lua 5.2.4?

ok i really dont know what i have done ( i have reinstalled torch and run lua install 5.3 instead of 5.2) but know i have managed to go through the error to get stuck on another one:

Generating data ... ... resolve time: 48.398242950439 /home/painkillerrr/torch/install/bin/lua: cannot open <../Data/TrainSamples/NoLimit/1529964083-7h3cThKcKd-1.inputs> in mode w at /home/painkillerrr/torch/pkg/torch/lib/TH/THDiskFile.c:673 ...

lorrp1 avatar Jun 25 '18 21:06 lorrp1

No, I'm using lua 5.2.3 but 5.2.4 should work also.

Can you paste what error you got after re-installing torch with the new tensormath.lua files?

happypepper avatar Jun 25 '18 22:06 happypepper

ok i really dont know what i have done ( i have reinstalled torch and run lua install 5.3 instead of 5.2) but know i have managed to go through the error to get stuck on another one:

Generating data ... ... resolve time: 48.398242950439 /home/painkillerrr/torch/install/bin/lua: cannot open <../Data/TrainSamples/NoLimit/1529964083-7h3cThKcKd-1.inputs> in mode w at /home/painkillerrr/torch/pkg/torch/lib/TH/THDiskFile.c:673 ...

the is no folder in data callaed trainsample

lorrp1 avatar Jun 25 '18 22:06 lorrp1

That is good news, it means it succeeded in generating the data.

There is a problem in writing the data file. You need to create a NoLimit folder inside TrainSamples otherwise it will fail to write to any files.

happypepper avatar Jun 26 '18 00:06 happypepper

im pretty sure: TORCH_LUA_VERSION=LUA52 ./install.sh fixed even this issue.

@happypepper

how did you you managed to make deepholdem play vs "Slumbot 2017"??

lorrp1 avatar Jun 26 '18 09:06 lorrp1

I can't get around this scatterAdd issue. Generating data ... /root/torch/install/bin/lua: ./Game/card_tools.lua:30: attempt to call a nil value (method 'scatterAdd') stack traceback: ./Game/card_tools.lua:30: in function 'Game.card_tools.get_possible_hands_mask' ./Game/Evaluation/evaluator.lua:137: in function 'Game.Evaluation.evaluator.evaluate_fast' (...tail calls...) ./TerminalEquity/terminal_equity.lua:74: in method 'get_last_round_call_matrix' ./TerminalEquity/terminal_equity.lua:179: in method '_set_call_matrix' ./TerminalEquity/terminal_equity.lua:217: in method 'set_board' ./DataGeneration/data_generation.lua:58: in function 'DataGeneration.data_generation.generate_data_file' ./DataGeneration/data_generation.lua:24: in function 'DataGeneration.data_generation.generate_data' DataGeneration/main_data_generation.lua:14: in main chunk [C]: in function 'dofile' /root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: in ?

I got it running on a google compute engine. But it just doesn't work locally. I have reinstalled torch a couple of times (5.2 and 5.3) and made sure the modified TensorMath.lua files were in place beforehand. I am out of ideas now. It's working with CPU though.

EDIT: just solved the issue. Running install.sh as sudo helped.

lh14576 avatar Nov 03 '18 09:11 lh14576

@lh14576 I have the exact same error. With the modified TensorMath.lua files, it works on CPU but not on GPU. Any specific thing you did apart from running install.sh as sudo? (I ran everything as root)

dcarnino avatar Nov 28 '19 11:11 dcarnino