Skip to content

Instantly share code, notes, and snippets.

@xmfcx
Last active April 15, 2025 13:47
Show Gist options
  • Save xmfcx/a5e32fdecfcd85c6cc9d472ce7a3a98d to your computer and use it in GitHub Desktop.
Save xmfcx/a5e32fdecfcd85c6cc9d472ce7a3a98d to your computer and use it in GitHub Desktop.
Running Carla Sim 0.10.0 with low VRAM on docker

Running Carla Sim 0.10.0 with low VRAM on docker

Steps

Pull the image:

docker pull carlasim/carla:0.10.0

Download the simulator binary:

mkdir -p $HOME/Downloads/carla
cd $HOME/Downloads/carla
wget https://tiny.carla.org/carla-0-10-0-linux-tar -O Carla-0.10.0-Linux-Shipping.tar.gz
tar -xvzf Carla-0.10.0-Linux-Shipping.tar.gz

↔️ Replace the $HOME/Downloads/carla/Carla-0.10.0-Linux-Shipping/CarlaUnreal/Config/DefaultEngine.ini with the provided file in this gist below.

🔎 Run watch -n 0.1 nvidia-smi on a separate terminal to track VRAM usage.

▶️ Run the following command to start the simulator:

docker run -it --rm \
  --runtime=nvidia \
  --net=host \
  --env=DISPLAY=$DISPLAY \
  --env=NVIDIA_VISIBLE_DEVICES=all \
  --env=NVIDIA_DRIVER_CAPABILITIES=all \
  --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
  --volume="$HOME/Downloads/carla/Carla-0.10.0-Linux-Shipping/:/home/carla/host-carla" \
  --workdir="/home/carla/host-carla" \
  carlasim/carla:0.10.0 \
  bash CarlaUnreal.sh -nosound

⚠️ At first, you will see a black window. Watch the nvidia-smi terminal for the GPU VRAM usage. For me, once it reached to about 6GB of usage, it showed the simulation screen correctly.

Docker run command with explanations:

docker run -it --rm \
  --runtime=nvidia \                        # Use NVIDIA runtime for GPU access
  --net=host \                              # Use the host's network stack (helps with networking/performance)
  --env=DISPLAY=$DISPLAY \                  # Pass the host's DISPLAY environment variable (for GUI forwarding)
  --env=NVIDIA_VISIBLE_DEVICES=all \        # Expose all GPUs to the container
  --env=NVIDIA_DRIVER_CAPABILITIES=all \    # Enable all driver capabilities (graphics, compute, etc.)
  --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ # Mount X11 UNIX socket to enable GUI apps to display
  --volume="$HOME/Downloads/carla/Carla-0.10.0-Linux-Shipping/:/home/carla/host-carla" \ 
                                              # Mount your local CARLA folder into the container
  --workdir="/home/carla/host-carla" \        # Set the working directory to the mounted CARLA folder
  carlasim/carla:0.10.0 \                    # Use the official CARLA Docker image, version 0.10.0
  bash CarlaUnreal.sh -nosound              # Run the CARLA startup script with -nosound flag

References

[/Script/Engine.Engine]
bSmoothFrameRate=false
SmoothedFrameRateRange=(LowerBound=(Type="ERangeBoundTypes::Inclusive",Value=22),UpperBound=(Type="ERangeBoundTypes::Exclusive",Value=120))
[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop
AppliedTargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
AppliedDefaultGraphicsPerformance=Maximum
[/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/Carla/Maps/Town10HD_Opt.Town10HD_Opt
GameDefaultMap=/Game/Carla/Maps/Town10HD_Opt.Town10HD_Opt
ServerDefaultMap=/Game/Carla/Maps/Town10HD_Opt.Town10HD_Opt
GlobalDefaultGameMode=/Game/Carla/Blueprints/Game/CarlaGameMode.CarlaGameMode_C
GameInstanceClass=/Script/Carla.CarlaGameInstance
TransitionMap=/Game/Carla/Maps/Town10HD_Opt.Town10HD_Opt
GlobalDefaultServerGameMode=/Game/Carla/Blueprints/Game/CarlaGameMode.CarlaGameMode_C
[/Script/Engine.RendererSettings]
r.DefaultFeature.MotionBlur=True
r.VelocityOutputPass=True
r.AllowStaticLighting=True
r.DiscardUnusedQuality=True
r.DefaultFeature.Bloom=False
r.DefaultFeature.AmbientOcclusion=False
r.DefaultFeature.AmbientOcclusionStaticFraction=False
r.DefaultFeature.AutoExposure=False
r.CustomDepth=3
r.TextureStreaming=True
r.GenerateMeshDistanceFields=False
r.DistanceFieldBuild.EightBit=False
r.DistanceFieldBuild.Compress=False
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
r.GPUSkin.Support16BitBoneIndex=True
r.GPUSkin.UnlimitedBoneInfluences=True
r.SkinCache.CompileShaders=True
SkeletalMesh.UseExperimentalChunking=1
r.ReflectionMethod=1
r.DynamicGlobalIlluminationMethod=0
r.RayTracing.Shadows=False
r.RayTracing.UseTextureLod=False
r.PathTracing=False
r.RayTracing.Shadows.AvoidSelfIntersectionTraceDistance=6
r.ReflectionCaptureResolution=256
r.SkinCache.SceneMemoryLimitInMB=1024
r.CARLA.EnableSegmentationRendering=1
r.Shadow.Virtual.Enable=1
r.RayTracing=False # Disable ray tracing completely
r.Lumen.Enabled=0
r.Lumen.Reflections.Quality=0
r.Lumen.HardwareRayTracing=False
r.Lumen.HardwareRayTracing.LightingMode=0
r.Lumen.GlobalIllumination=0 # Disable Lumen GI
r.ReflectionMethod=2 # Disable reflections
r.VirtualTextures=True
r.DistanceFields.AtlasSizeXY=256 # Reduce memory usage for distance fields
r.DistanceFields.AtlasSizeZ=512
r.Streaming.PoolSize=4000 # Reduce VRAM usage
r.HZBOcclusion=1
r.ViewDistanceScale=0.5 # Reduce view distance
r.DefaultFeature.AntiAliasing=2
r.Lumen.Reflections.HardwareRayTracing.Translucent.Refraction.EnableForProject=False
[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=False
bAutoRegisterNewPawnsAsSources=False
[/Script/NavigationSystem.RecastNavMesh]
RuntimeGeneration=Static
[/Script/AIModule.CrowdManager]
MaxAgents=1000
[/Script/Engine.PhysicsSettings]
DefaultGravityZ=-980.000000
DefaultTerminalVelocity=4000.000000
DefaultFluidFriction=0.300000
SimulateScratchMemorySize=262144
RagdollAggregateThreshold=4
TriangleMeshTriangleMinAreaThreshold=5.000000
bEnableShapeSharing=False
bEnablePCM=False
bEnableStabilization=False
bWarnMissingLocks=True
bEnable2DPhysics=False
PhysicErrorCorrection=(PingExtrapolation=0.100000,PingLimit=100.000000,ErrorPerLinearDifference=1.000000,ErrorPerAngularDifference=1.000000,MaxRestoredStateError=1.000000,MaxLinearHardSnapDistance=400.000000,PositionLerp=0.000000,AngleLerp=0.400000,LinearVelocityCoefficient=100.000000,AngularVelocityCoefficient=10.000000,ErrorAccumulationSeconds=0.500000,ErrorAccumulationDistanceSq=15.000000,ErrorAccumulationSimilarity=100.000000)
LockedAxis=Invalid
DefaultDegreesOfFreedom=Full3D
BounceThresholdVelocity=200.000000
FrictionCombineMode=Average
RestitutionCombineMode=Average
MaxAngularVelocity=3600.000000
MaxDepenetrationVelocity=0.000000
ContactOffsetMultiplier=0.010000
MinContactOffset=0.000100
MaxContactOffset=1.000000
bSimulateSkeletalMeshOnDedicatedServer=True
DefaultShapeComplexity=CTF_UseSimpleAndComplex
bDefaultHasComplexCollision=True
bSuppressFaceRemapTable=False
bSupportUVFromHitResults=False
bDisableActiveActors=False
bDisableKinematicStaticPairs=False
bDisableKinematicKinematicPairs=False
bDisableCCD=False
bEnableEnhancedDeterminism=True
MaxPhysicsDeltaTime=0.333330
bSubstepping=True
bSubsteppingAsync=False
MaxSubstepDeltaTime=0.010000
MaxSubsteps=10
SyncSceneSmoothingFactor=0.000000
InitialAverageFrameRate=0.016667
# PhysXTreeRebuildRate=10
DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2)
[/Script/LinuxTargetPlatform.LinuxTargetSettings]
SpatializationPlugin=
SourceDataOverridePlugin=
ReverbPlugin=
OcclusionPlugin=
SoundCueCookQualityIndex=-1
-TargetedRHIs=SF_VULKAN_SM5
+TargetedRHIs=SF_VULKAN_SM6
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12
-D3D12TargetedShaderFormats=PCD3D_SM5
+D3D12TargetedShaderFormats=PCD3D_SM6
-VulkanTargetedShaderFormats=SF_VULKAN_SM6
Compiler=Default
AudioSampleRate=48000
AudioCallbackBufferFrameSize=1024
AudioNumBuffersToEnqueue=1
AudioMaxChannels=0
AudioNumSourceWorkers=4
SpatializationPlugin=
SourceDataOverridePlugin=
ReverbPlugin=
OcclusionPlugin=
CompressionOverrides=(bOverrideCompressionTimes=False,DurationThreshold=5.000000,MaxNumRandomBranches=0,SoundCueQualityIndex=0)
CacheSizeKB=0
MaxChunkSizeOverrideKB=0
bResampleForDevice=False
MaxSampleRate=0.000000
HighSampleRate=0.000000
MedSampleRate=0.000000
LowSampleRate=0.000000
MinSampleRate=0.000000
CompressionQualityModifier=0.000000
AutoStreamingThreshold=0.000000
SoundCueCookQualityIndex=-1
[/Script/Engine.CollisionProfile]
+Profiles=(Name="CustomSensorCollision",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="SensorObject",CustomResponses=((Channel="WorldStatic",Response=ECR_Ignore),(Channel="WorldDynamic",Response=ECR_Ignore),(Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore),(Channel="SensorObject"),(Channel="SensorTrace")),HelpMessage="Used for custom collision meshes for objects that has very complex meshes but we want them to appear in raycast based sensors")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Ignore,bTraceType=False,bStaticObject=False,Name="SensorObject")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Ignore,bTraceType=True,bStaticObject=False,Name="SensorTrace")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel3,DefaultResponse=ECR_Overlap,bTraceType=True,bStaticObject=False,Name="OverlapChannel")
+EditProfiles=(Name="BlockAll",CustomResponses=((Channel="SensorObject"),(Channel="SensorTrace")))
+EditProfiles=(Name="OverlapAll",CustomResponses=((Channel="SensorObject",Response=ECR_Overlap),(Channel="SensorTrace",Response=ECR_Overlap)))
[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings]
bEnablePlugin=True
bAllowNetworkConnection=True
SecurityToken=9054E0B944FB8898FCDC94BAD5B596A0
bIncludeInShipping=False
bAllowExternalStartInShipping=False
bCompileAFSProject=False
bUseCompression=False
bLogFiles=False
bReportStats=False
ConnectionType=USBOnly
bUseManualIPAddress=False
ManualIPAddress=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment