Comments (5)
Hi Mohit,
Thanks for your help! This did the trick.
For some reason I had to specify 1 as the display to startx.py and reconfigure the display Thor uses to :1 in gen/constants.py. Perhaps because I have my EC2 instance enabled for xRDP and it always has some Xorg processes running on :0.
I could be totally wrong there, but nonetheless, thank you for your help, and for providing this great resource to the community!
Best,
Shane
from alfred.
Hi @shanestorks, thanks for your interest!
Forwarding this from @ekolve:
Running on headless AWS machines is possible, the main requirement is that you use a GPU machine to support OpenGL rendering. I have attached a script 'startx.py', which examines the GPU devices on the host, generates a xorg.conf file and then starts X. You can then run ai2thor as you normally would. By default, the :0.0 display will be used, but if you are running on a machine with more than one GPU, you can address these by modifying the screen component of the display. So :0.0 refers to the first device, :0.1 the second and so on.
startx.py
:
#!/usr/bin/env python
import subprocess
import shlex
import re
import platform
import tempfile
import os
import sys
def pci_records():
records = []
command = shlex.split('lspci -vmm')
output = subprocess.check_output(command).decode()
for devices in output.strip().split("\n\n"):
record = {}
records.append(record)
for row in devices.split("\n"):
key, value = row.split("\t")
record[key.split(':')[0]] = value
return records
def generate_xorg_conf(devices):
xorg_conf = []
device_section = """
Section "Device"
Identifier "Device{device_id}"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BusID "{bus_id}"
EndSection
"""
server_layout_section = """
Section "ServerLayout"
Identifier "Layout0"
{screen_records}
EndSection
"""
screen_section = """
Section "Screen"
Identifier "Screen{screen_id}"
Device "Device{device_id}"
DefaultDepth 24
Option "AllowEmptyInitialConfiguration" "True"
SubSection "Display"
Depth 24
Virtual 1024 768
EndSubSection
EndSection
"""
screen_records = []
for i, bus_id in enumerate(devices):
xorg_conf.append(device_section.format(device_id=i, bus_id=bus_id))
xorg_conf.append(screen_section.format(device_id=i, screen_id=i))
screen_records.append('Screen {screen_id} "Screen{screen_id}" 0 0'.format(screen_id=i))
xorg_conf.append(server_layout_section.format(screen_records="\n ".join(screen_records)))
output = "\n".join(xorg_conf)
print(output)
return output
def startx(display):
if platform.system() != 'Linux':
raise Exception("Can only run startx on linux")
devices = []
for r in pci_records():
if r.get('Vendor', '') == 'NVIDIA Corporation'\
and r['Class'] in ['VGA compatible controller', '3D controller']:
bus_id = 'PCI:' + ':'.join(map(lambda x: str(int(x, 16)), re.split(r'[:\.]', r['Slot'])))
devices.append(bus_id)
if not devices:
raise Exception("no nvidia cards found")
try:
fd, path = tempfile.mkstemp()
with open(path, "w") as f:
f.write(generate_xorg_conf(devices))
command = shlex.split("Xorg -noreset +extension GLX +extension RANDR +extension RENDER -config %s :%s" % (path, display))
subprocess.call(command)
finally:
os.close(fd)
os.unlink(path)
if __name__ == '__main__':
display = 0
if len(sys.argv) > 1:
display = int(sys.argv[1])
print("Starting X on DISPLAY=:%s" % display)
startx(display)
from alfred.
Hi @MohitShridhar. I ran the code alfred/gen/scripts/generate_trajectories.py on the server and ran into the similar error. The server is not connected to any display. Is there anyway to run the data generation script without display?
from alfred.
I ran the startx.py, and it shows "/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server".
from alfred.
For running on a headless server, see: https://github.com/askforalfred/alfred#cloud-instance
"/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server".
This seems like a permissions issue. Have you looked at this:
https://unix.stackexchange.com/questions/437809/start-x-server-on-login-with-systemd
from alfred.
Related Issues (20)
- planner pickup action HOT 1
- Question about Resnet-18 to encode vision info in Alfred benchmark HOT 1
- Stuck in controller.step() HOT 11
- Are there missing objects in GT segmentation? HOT 5
- Question about generating new data, does splits/oct21.json need to be changed? HOT 1
- Inquiry Regarding the Leaderboard HOT 1
- What is the best way to get a GT mask? HOT 7
- Is it possible to build a GT navigator using AI2THOR 2.1.0? HOT 8
- Mismatch between the expert demonstration actions and environment action HOT 5
- Questions about the raw images in the dataset HOT 1
- Error in Preprocessing dataset HOT 1
- Position Distribution of Each Object HOT 1
- Dockerfile Outdated
- dataset reading problem HOT 3
- how to calculate the task success HOT 1
- Question about target instance id?
- PDDL representation for domain and initial states HOT 2
- Error about Socket Exception HOT 3
- x11 forwarding for headless server
- TypeError: string indices must be integers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alfred.