@@ -668,12 +668,6 @@ def run_frontend(self):
668668 "/var/run/docker.sock not found, please check if Docker is running and Docker Compose is installed."
669669 )
670670
671- try :
672- subprocess .check_call (["nvidia-smi" ])
673- self .gpu_available = True
674- except Exception :
675- logging .info ("No GPU available for the frontend, nodes will be deploy in CPU mode" )
676-
677671 network_name = f"{ os .environ ['USER' ]} _nebula-net-base"
678672
679673 # Create the Docker network
@@ -684,7 +678,6 @@ def run_frontend(self):
684678 environment = {
685679 "NEBULA_CONTROLLER_NAME" : os .environ ["USER" ],
686680 "NEBULA_PRODUCTION" : self .production ,
687- "NEBULA_GPU_AVAILABLE" : self .gpu_available ,
688681 "NEBULA_ADVANCED_ANALYTICS" : self .advanced_analytics ,
689682 "NEBULA_FRONTEND_LOG" : "/nebula/app/logs/frontend.log" ,
690683 "NEBULA_LOGS_DIR" : "/nebula/app/logs/" ,
@@ -756,6 +749,12 @@ def run_controller(self):
756749 )
757750
758751 network_name = f"{ os .environ ['USER' ]} _nebula-net-base"
752+
753+ try :
754+ subprocess .check_call (["nvidia-smi" ])
755+ self .gpu_available = True
756+ except Exception :
757+ logging .info ("No GPU available for the frontend, nodes will be deploy in CPU mode" )
759758
760759 # Create the Docker network
761760 base = DockerUtils .create_docker_network (network_name )
@@ -790,6 +789,11 @@ def run_controller(self):
790789 ],
791790 extra_hosts = {"host.docker.internal" : "host-gateway" },
792791 port_bindings = {self .controller_port : self .controller_port },
792+ device_requests = [{
793+ "Driver" : "nvidia" ,
794+ "Count" : - 1 ,
795+ "Capabilities" : [["gpu" ]],
796+ }] if self .gpu_available else None ,
793797 )
794798
795799 networking_config = client .api .create_networking_config ({
0 commit comments