lpereira / lwan

Experimental, scalable, high performance HTTP server
https://lwan.ws
GNU General Public License v2.0
5.94k stars 548 forks source link

NVCC failed inside a handler #106

Closed byzhang closed 9 years ago

byzhang commented 9 years ago

A handler is calling NVCC to compile some cuda code, and NVCC failed with such error:

<built-in>: fatal error: when writing output to : Bad file descriptor
compilation terminated.

The nvcc command is

nvcc -ptx -O3 -arch=sm_35  -o /home/byzhang/.vexcl/d1/4c0b91244422075b4c0ee6fa8580222e946889/kernel.ptx /home/byzhang/.vexcl/d1/4c0b91244422075b4c0ee6fa8580222e946889/kernel.cu

I checked kernel.cu exists (which created by ofstream in the handler as well) and such command succeeded when I ran it in console. I heard about nvcc unconditionally closs fds 0/1, does lwan already closes 0/1 before calling the handler? Can you show me the code so I can try to comment out and verify whether it's the reason?

lpereira commented 9 years ago

Yes, lwan closes stdin. I don't remember where but it's in lwan.c; just look for calls to close().

byzhang commented 9 years ago

It make nvcc pass after commenting close stdin. Is the closing necessary?

lpereira commented 9 years ago

Not strictly necessary. It's just closed because it's not used, and that's a file descriptor that can be used for something else.

byzhang commented 9 years ago

Do you want to remove it? I can make a pull request if you prefer.

lpereira commented 9 years ago

Sorry for replying this so late!

Yes, feel free to make a PR moving the close(stdin) to the lwan executable, away from the library.