happypepper / DeepHoldem

205 stars 65 forks source link

scatterAdd not working #5

Open matthiasanderer opened 6 years ago

matthiasanderer commented 6 years ago

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)

happypepper commented 6 years ago

@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

lorrp1 commented 6 years ago

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 ?

happypepper commented 6 years ago

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

lorrp1 commented 6 years ago

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 commented 6 years ago

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

happypepper commented 6 years ago

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

lorrp1 commented 6 years ago

still the same error

very sad since its the only stuff id like to try

lorrp1 commented 6 years ago

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 ...

happypepper commented 6 years ago

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?

lorrp1 commented 6 years ago

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

happypepper commented 6 years ago

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.

lorrp1 commented 6 years ago

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"??

lh14576 commented 6 years ago

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.

dcarnino commented 4 years ago

@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)