-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (74 loc) · 3.38 KB
/
docker-compose.yml
File metadata and controls
82 lines (74 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
services:
# Database initialization container (simplified)
db-init:
build: .
volumes:
- ./logs:/app/logs
- ./trading_bot/data/local_data:/app/trading_bot/data/local_data
command: python -c "import os; import optuna; os.makedirs('logs/optuna_storage', exist_ok=True); optuna.create_study(study_name='nvidia_trading_optimization', direction='maximize', storage='sqlite:///logs/optuna_storage/optimization.db', load_if_exists=True); print('Study created successfully')"
# Optuna Dashboard
optuna-dashboard:
image: ghcr.io/optuna/optuna-dashboard
ports:
- "8080:8080"
volumes:
- ./logs/optuna_storage:/app
working_dir: /app
depends_on:
- db-init
command: sqlite:///optimization.db
trading-bot:
build: .
volumes:
- ./logs:/app/logs
- ./trading_bot/data/local_data:/app/trading_bot/data/local_data
# GPU support with optimized settings
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
restart: unless-stopped
depends_on:
- db-init
environment:
# CPU Optimization for Ryzen 9 5950x (16 cores, 32 threads)
- CUDA_VISIBLE_DEVICES=0
- OMP_NUM_THREADS=32 # Utilize all 32 threads
- MKL_NUM_THREADS=32 # Intel MKL threading
- NUMBA_NUM_THREADS=32 # Numba threading
- OPENBLAS_NUM_THREADS=32 # OpenBLAS threading
- VECLIB_MAXIMUM_THREADS=32 # vecLib threading
# GPU Optimization for RTX 5060 TI
- PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512,garbage_collection_threshold:0.6
- CUDA_LAUNCH_BLOCKING=0 # Asynchronous CUDA operations
- TF_FORCE_GPU_ALLOW_GROWTH=true # Dynamic GPU memory allocation
- TF_GPU_ALLOCATOR=cuda_malloc_async
# Python Optimization
- PYTHONUNBUFFERED=1 # Better logging output
- PYTHONDONTWRITEBYTECODE=1 # Reduce I/O overhead
- NVIDIA_OPTIMIZATION_MODE=true # Enable optimization mode
# Memory Management
- MALLOC_ARENA_MAX=4 # Limit memory arenas for better performance
command: ["python", "-m", "trading_bot.sac.zoo.train",
"--algo", "sac",
"--env", "NVIDIAKnockout-v0",
"--device", "cuda",
"--optimize",
# Optimization Parameters - Scaled for 16-core CPU
"--n-trials", "300", # Increased trials
"--max-total-trials", "300",
"--n-jobs", "20", # Increased parallel jobs (16 cores + buffer)
"--sampler", "tpe",
"--pruner", "median",
# Evaluation Parameters - More thorough evaluation
"--n-evaluations", "6", # Increased evaluations per trial
"--eval-episodes", "12", # More evaluation episodes
"--eval-freq", "15000", # Slightly less frequent but more thorough
# Configuration and Storage
"--conf-file", "hyperparameters/sac.yml",
"--storage", "sqlite:///logs/optuna_storage/optimization.db",
"--study-name", "nvidia_trading_optimization",
"--optimization-log-path", "logs/optimizer_results"]