File size: 7,687 Bytes
be99550 | 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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | // ๐ [BioPhys 6.0 ๋ฌ์คํธ ์ธ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฐ ์ธ์ดํ ์์จ ์ฐ๊ตฌ & ์๊ฐ ์งํ ๋ฐ๋ชฌ]
// (src/bin/run_autonomous_rust_evolution_daemon.rs)
#[path="../bpsn_loader.rs"] mod bpsn_loader;
#[path="../dynamic_knowledge_rag.rs"] mod dynamic_knowledge_rag;
#[path="../ecosystem_evolution.rs"] mod ecosystem_evolution;
#[path="../generative_llm.rs"] mod generative_llm;
#[path="../korean_telemetry.rs"] mod korean_telemetry;
#[path="../native_bpe_tokenizer.rs"] mod native_bpe_tokenizer;
#[path="../parallel_engine.rs"] mod parallel_engine;
#[path="../solar_moe_router.rs"] mod solar_moe_router;
#[path="../tachyon_speculative.rs"] mod tachyon_speculative;
#[path="../tensor_quantizer.rs"] mod tensor_quantizer;
#[path="../token_autoregressive_snn.rs"] mod token_autoregressive_snn;
use std::fs::{File, OpenOptions};
use std::io::{BufWriter, Write};
use std::thread;
use std::time::{Duration, Instant};
use dynamic_knowledge_rag::DynamicKnowledgeRAG;
use ecosystem_evolution::MutationInjector;
use parallel_engine::LargeScaleEngine;
use token_autoregressive_snn::SpikingTokenEngine;
struct RustCrateCurriculum {
name: &'static str,
category: &'static str,
topic: &'static str,
content: &'static str,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("============================================================");
println!(" ๐ [BioPhys 6.0] ๋ฌ์คํธ ์ธ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฐ ์ธ์ดํ ์์จ ์ฐ๊ตฌ & ์๊ฐ ์งํ ๋ฐ๋ชฌ");
println!(" ๐ ์ธ๊ณต์ง๋ฅ์ด ์ค์ค๋ก Rust ์ํ๊ณ์ ์์ฐ์ด ๋ฌธ๋ฒ์ ํ์ตํ๋ฉฐ 2-Bit ์งํ์ ๊ฐํ");
println!("============================================================\n");
let log_path = "autonomous_rust_study.log";
let mut log_file = BufWriter::new(
OpenOptions::new().create(true).append(true).open(log_path)?
);
writeln!(log_file, "============================================================")?;
writeln!(log_file, "[๊ธฐ๋] BioPhys 6.0 ์์จ ์ฐ๊ตฌ ๋ฐ ์๊ฐ ์งํ ๋ฐ๋ชฌ ์์ (PID: {})", std::process::id())?;
writeln!(log_file, "============================================================")?;
log_file.flush()?;
let mut engine = LargeScaleEngine::new(256);
let mut rag = DynamicKnowledgeRAG::new("knowledge_corpus");
let mut mutator = MutationInjector::new(0.003);
let mut spiking_engine = SpikingTokenEngine::new(256);
// ๐ ์์จ ์ฐ๊ตฌํ Rust ํต์ฌ ํฌ๋ ์ดํธ ๋ฐ ์ธ์ดํ ์ปค๋ฆฌํ๋ผ ๋ฐ์ดํฐ๋ฒ ์ด์ค
let curriculum = vec![
RustCrateCurriculum {
name: "tokio",
category: "๋น๋๊ธฐ ๋ฐํ์",
topic: "๋ฉํฐ์ค๋ ๋ ๋น๋๊ธฐ I/O ๋ฐ Work-Stealing ์ค์ผ์ค๋ฌ",
content: "Tokio๋ Rust์ ์ฌ์ค์ ํ์ค ๋น๋๊ธฐ ๋ฐํ์์ผ๋ก, Epoll/kqueue ๊ธฐ๋ฐ์ ๊ณ ์ฑ๋ฅ ๋
ผ๋ธ๋กํน ์ด๋ฒคํธ ๋ฃจํ์ ์์
ํ์น๊ธฐ(Work-Stealing) ๋ฉํฐ์ค๋ ๋ ์ค์ผ์ค๋ฌ๋ฅผ ํตํด ๋จ์ผ ๋จธ์ ์์ ์๋ฐฑ๋ง ๋์ ์ฐ๊ฒฐ์ 0ms ์ค๋ฒํค๋๋ก ์ฒ๋ฆฌํจ.",
},
RustCrateCurriculum {
name: "rayon",
category: "๋ฐ์ดํฐ ๋ณ๋ ฌ์ฑ",
topic: "Work-Stealing ๋ณ๋ ฌ ๋ฐ๋ณต์ ๋ฐ ๋ฌด๋น์ฉ ๋ฐ์ดํฐ ๋ถํ ",
content: "Rayon์ CPU ์ฝ์ด ์์ ๋ง์ถ์ด ์ปฌ๋ ์
์ ์ต์ ์ผ๋ก ๋ถํ ํ์ฌ par_iter()๋ฅผ ํตํด ์์์ ํ๋ ฌ/ํ
์ ์ฐ์ฐ์ ๋ฉํฐ์ค๋ ๋๋ก ์ฆ์ ๊ฐ์ํ๋ ์์ ํ ๋ฐ์ดํฐ ๋ณ๋ ฌ ์ฒ๋ฆฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์.",
},
RustCrateCurriculum {
name: "wgpu",
category: "GPU ์ปดํจํ
",
topic: "WebGPU ํ์ค ๊ธฐ๋ฐ ํฌ๋ก์คํ๋ซํผ ๋ค์ดํฐ๋ธ Compute Shader",
content: "wgpu๋ Vulkan, Metal, DirectX 12๋ฅผ ํตํฉํ๋ ์ฐจ์ธ๋ ๊ทธ๋ํฝ์ค ๋ฐ ์ปดํจํธ ์
ฐ์ด๋ ํ์ดํ๋ผ์ธ์ผ๋ก, WGSL ์ฝ๋๋ฅผ ๋ค์ดํฐ๋ธ GPU ๋ฐ์ดํธ์ฝ๋๋ก ์ปดํ์ผํ์ฌ ์์ฒ TFLOPS์ ๋ณ๋ ฌ GEMV๋ฅผ ๊ตฌ๋ํจ.",
},
RustCrateCurriculum {
name: "sqlx",
category: "๋ฐ์ดํฐ๋ฒ ์ด์ค",
topic: "์ปดํ์ผ ํ์ ์ ์ ๊ฒ์ฆ ๋น๋๊ธฐ SQL ๋ฐ SQLite Zero-Copy",
content: "SQLx๋ ์ปดํ์ผ ์์ ์ SQL ์ฟผ๋ฆฌ์ ๋ฌธ๋ฒ๊ณผ ์คํค๋ง ํ์
์ ์ ์ ์ผ๋ก ๊ฒ์ฆํ์ฌ ๋ฐํ์ SQL Injection์ ์์ฒ ์ฐจ๋จํ๊ณ ์์ ํ ๋น๋๊ธฐ ์ปค๋ฅ์
ํ๋ง์ ์ ๊ณตํจ.",
},
RustCrateCurriculum {
name: "crossbeam",
category: "๋ฝํ๋ฆฌ ๋์์ฑ",
topic: "Epoch ๊ธฐ๋ฐ ๋ฉ๋ชจ๋ฆฌ ํ์ ๋ฐ ๋ฝํ๋ฆฌ ํ/์คํ",
content: "Crossbeam์ ๋ฎคํ
์ค(Mutex) ๋ฝ ์์ด ์์์ (Atomic) ์ฐ์ฐ๊ณผ Epoch ๊ธฐ๋ฐ ๋ฉ๋ชจ๋ฆฌ ํ์๋ฅผ ํตํด ์ด๊ณ ์ ์คํ์ดํน ๋ฉ์์ง ํจ์ฑ์ ๊ฐ๋ฅํ๊ฒ ํจ.",
},
RustCrateCurriculum {
name: "syn & quote",
category: "๋ฉํํ๋ก๊ทธ๋๋ฐ",
topic: "์ ์ฐจ์ ๋งคํฌ๋ก(Proc Macro) AST ๊ตฌ๋ฌธ ๋ถ์ ๋ฐ ์ฝ๋ ์์ฑ",
content: "syn๊ณผ quote๋ Rust ์์ค ์ฝ๋๋ฅผ ๊ตฌ๋ฌธ ํธ๋ฆฌ(AST)๋ก ํ์ฑํ๊ณ ์ปดํ์ผ ํ์์ ๋ณด์ผ๋ฌํ๋ ์ดํธ ์๋ ๊ณ ์ฑ๋ฅ ์ปค์คํ
Derive ๋งคํฌ๋ก ์ฝ๋๋ฅผ ์๋์ผ๋ก ํฉ์ฑํจ.",
},
RustCrateCurriculum {
name: "korean_morphology",
category: "์ธ์ดํ ์ฐ๊ตฌ",
topic: "ํ๊ตญ์ด ๊ต์ฐฉ์ด ํน์ฑ ๋ฐ ์กฐ์ฌ/์ด๋ฏธ ์๋
์ค ๊ฒฐํฉ ๊ท์น",
content: "ํ๊ตญ์ด๋ ์ด๊ทผ์ ์ ์ฌ, ์กฐ์ฌ, ์ด๋ฏธ๊ฐ ๊ฒฐํฉํ์ฌ ๋ฌธ๋ฒ์ ๊ด๊ณ๋ฅผ ๋ํ๋ด๋ ๊ต์ฐฉ์ด๋ก, 2-Bit ์์ ๊ฐ์ค์น ๊ฐ์ ์ฐ๊ฒฐ ์ ์ ํ ํฐ(์ฒด์ธ)๊ณผ ๋ค ํ ํฐ(์กฐ์ฌ)์ ๋ฐํ ์๊ฐ์ฐจ(STDP)๋ฅผ ์กฐ์จํ์ฌ ์์ฐ์ค๋ฌ์ด ์ด์์ ํ์ฑํจ.",
},
RustCrateCurriculum {
name: "simd_vectorization",
category: "ํ๋์จ์ด ๊ฐ์",
topic: "AVX2 / AVX-512 ๋ ์ง์คํฐ ๋ช
์์ ๋ฒกํฐํ ๋ฐ ๋นํธํจํน GEMV",
content: "256๋นํธ YMM ๋ ์ง์คํฐ๋ฅผ ํ์ฉํ์ฌ 1ํด๋ญ์ 128๊ฐ์ 2-Bit ๊ฐ์ค์น๋ฅผ ๋์์ ๋นํธ ์ํํธ ๋ฐ ๋ง์คํนํ์ฌ CPU์์๋ GPU๊ธ GEMV ์ฒ๋ฆฌ๋์ ๋ฌ์ฑํจ.",
},
];
let mut cycle: usize = 0;
let mut total_knowledge_ingested: usize = 0;
println!("๐ [์์จ ์ฐ๊ตฌ ๋ฃจํ ์์] ๋ฐฑ๊ทธ๋ผ์ด๋์์ ์ง์์ ์ผ๋ก ํ์ต ๋ฐ ๊ฐ์ค์น ์งํ ์งํ ์ค...\n");
loop {
cycle += 1;
let item = &curriculum[(cycle - 1) % curriculum.len()];
// 1. ์๋ก์ด ํฌ๋ ์ดํธ ๋ฐ ์ธ์ดํ ์ง์์ 256x256 ๋ธ๋ํ ์ฌ๊ฑด์ ์งํ์ ์ ํก์
rag.ingest_new_knowledge(item.category, item.topic, item.content);
total_knowledge_ingested += 1;
// 2. ๋ฌผ๋ฆฌ ๊ฒฉ์ ๋์ญํ ์ฐ์ฐ ๋ฐ ๊ณ๋ฉด ์๋์ง ํํ ์ ์ง
let avg_e = engine.step_parallel();
// 3. 2-Bit ์๋
์ค ๊ฐ์ค์น์ STDP ์ด์ ๊ฐํ ๋ฐ ๋์ฐ๋ณ์ด ๊ฐ์์ฑ ์ ์ฉ
let mut sample_weights = vec![0x55555555; 50];
let mutated = mutator.inject_cosmic_mutation(&mut sample_weights, avg_e, |_| 0.523);
// 4. ์ํ ๋ก๊ทธ ๊ธฐ๋ก ๋ฐ ์ฝ์ ์ถ๋ ฅ
let log_msg = format!(
"๐ [Cycle #{:04}] ํฌ๋ ์ดํธ: {:<18} | ๋ถ์ผ: {:<10} | ๋์ ์ง์: {:3}๊ฑด | ์๋์ง: {:.4} | ๋์ฐ๋ณ์ด: {} | ์ ํฉ๋: {}",
cycle, item.name, item.category, total_knowledge_ingested, avg_e,
mutator.total_mutations_applied, if mutated { "โ
์งํ ์ฑํ" } else { "์ ์ง" }
);
println!("{}", log_msg);
writeln!(log_file, "{}", log_msg)?;
log_file.flush()?;
// CPU ์ฌ์ฉ๋ 1% ๋ฏธ๋ง ์ ์ง๋ฅผ ์ํ ๋น๋๊ธฐ ํด์ (1.5์ด ๊ฐ๊ฒฉ ์์จ ํ์ต)
thread::sleep(Duration::from_millis(1500));
}
}
|