d2l-ai / d2l-en

Interactive deep learning book with multi-framework code, math, and discussions. Adopted at 500 universities from 70 countries including Stanford, MIT, Harvard, and Cambridge.
https://D2L.ai
Other
23.08k stars 4.26k forks source link

chapter_computational-performance/multiple-gpus-gluon.md failure #903

Open ChaiBapchya opened 4 years ago

ChaiBapchya commented 4 years ago

Upon running on latest master

61f01e3c (HEAD -> master, upstream/master, origin/master, origin/HEAD) add chapter author photos

Command

d2l-en bapac$ d2lbook build html

It fails with IndexError: list index out of range

Stack Trace

[d2lbook:build.py:L118] INFO   [31/165, 00:09:15] Evaluating ./chapter_computational-performance/multiple-gpus-gluon.md, save as _build/eval/chapter_computational-performance/multiple-gpus-gluon.ipynb
[d2lbook:execute.py:L404] INFO   Executing notebook with kernel: python
Traceback (most recent call last):
  File "/Users/bapac/anaconda3/bin/d2lbook", line 8, in <module>
    sys.exit(main())
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/d2lbook/main.py", line 22, in main
    commands[args.command[0]]()
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/d2lbook/build.py", line 35, in build
    getattr(builder, cmd)()
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/d2lbook/build.py", line 45, in warp
    func(self)
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/d2lbook/build.py", line 243, in html
    self.rst()
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/d2lbook/build.py", line 45, in warp
    func(self)
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/d2lbook/build.py", line 222, in rst
    self.eval()
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/d2lbook/build.py", line 45, in warp
    func(self)
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/d2lbook/build.py", line 122, in eval
    default_tab=self.config.default_tab)
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/d2lbook/build.py", line 385, in process_and_eval_notebook
    notedown.run(nb, timeout)
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/notedown/notedown.py", line 48, in run
    notebook, resources = executor.preprocess(notebook, resources={})
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 405, in preprocess
    nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/nbconvert/preprocessors/base.py", line 69, in preprocess
    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
  File "/Users/bapac/anaconda3/lib/python3.7/site-packages/nbconvert/preprocessors/execute.py", line 448, in preprocess_cell
    raise CellExecutionError.from_cell_and_msg(cell, out)
nbconvert.preprocessors.execute.CellExecutionError: An error occurred while executing the following cell:
------------------
x = np.random.uniform(size=(4, 1, 28, 28))
x_shards = gluon.utils.split_and_load(x, ctx)
net(x_shards[0]), net(x_shards[1])
------------------

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-4-823c783a14ce> in <module>
      1 x = np.random.uniform(size=(4, 1, 28, 28))
      2 x_shards = gluon.utils.split_and_load(x, ctx)
----> 3 net(x_shards[0]), net(x_shards[1])

IndexError: list index out of range
IndexError: list index out of range
mli commented 4 years ago

@astonzhang we need to check if there are two gpus to use x_shards[0] and x_shards[1]

astonzhang commented 4 years ago

Sure. Currently we require that the machine has to have at least 2 GPUs.

astonzhang commented 4 years ago

@ChaiBapchya For now, can you put such notebooks that require > 2 GPUs in exclusions of config.ini: https://github.com/d2l-ai/d2l-en/blob/master/config.ini#L28 ?

ChaiBapchya commented 4 years ago

And should this be for local testing or pushed as a change to master?

astonzhang commented 4 years ago

local testing