From deb11b0f3aa24d1b1dc091cbe34dca3397d9edcb Mon Sep 17 00:00:00 2001 From: Yusheng Xu <1422286969@qq.com> Date: Tue, 12 Mar 2024 15:17:22 +0800 Subject: [PATCH] Site updated: 2024-03-12 15:17:21 --- about/{index.html => disable_index.html} | 16 +- archives/2021/01/index.html | 10 +- archives/2021/index.html | 10 +- archives/2022/11/index.html | 10 +- archives/2022/index.html | 10 +- archives/2023/05/index.html | 30 +- archives/2023/06/index.html | 443 ++++++++++++++++++ archives/2023/index.html | 26 +- archives/index.html | 26 +- baidusitemap.xml | 4 +- categories/{CUDA => Lab}/index.html | 28 +- categories/MISC/index.html | 10 +- categories/index.html | 12 +- categories/ocaml/index.html | 10 +- categories/rust/index.html | 10 +- css/main.css | 162 ++----- html/collection2023.html | 16 + index.html | 60 +-- .../4080/image-20210104212456443-1496512.png | Bin 37101 -> 0 bytes posts/4080/image-20210104212456443.png | Bin 37101 -> 0 bytes .../4080/image-20210104215359261-1496512.png | Bin 57394 -> 0 bytes posts/4080/image-20210104215359261.png | Bin 57394 -> 0 bytes .../4080/image-20210104221045493-1496512.png | Bin 54608 -> 0 bytes posts/4080/image-20210104221045493.png | Bin 54608 -> 0 bytes .../4080/image-20210105004203912-1496512.png | Bin 52897 -> 0 bytes posts/4080/image-20210105004203912.png | Bin 52897 -> 0 bytes .../4080/image-20210105004251316-1496512.png | Bin 53895 -> 0 bytes posts/4080/image-20210105004251316.png | Bin 53895 -> 0 bytes .../4080/image-20210105004503695-1496512.png | Bin 51007 -> 0 bytes posts/4080/image-20210105004503695.png | Bin 51007 -> 0 bytes .../4080/image-20210107195155968-1496512.png | Bin 47649 -> 0 bytes posts/4080/image-20210107195155968.png | Bin 47649 -> 0 bytes .../4080/image-20210107195704276-1496512.png | Bin 45519 -> 0 bytes posts/4080/image-20210107195704276.png | Bin 45519 -> 0 bytes .../4080/image-20210108183946379-1496512.png | Bin 7550 -> 0 bytes posts/4080/image-20210108183946379.png | Bin 7550 -> 0 bytes .../4080/image-20210108184007479-1496512.png | Bin 12408 -> 0 bytes posts/4080/image-20210108184007479.png | Bin 12408 -> 0 bytes .../4080/image-20210108184234026-1496512.png | Bin 15399 -> 0 bytes posts/4080/image-20210108184234026.png | Bin 15399 -> 0 bytes .../4080/image-20210108185746717-1496512.png | Bin 21501 -> 0 bytes posts/4080/image-20210108185746717.png | Bin 21501 -> 0 bytes .../4080/image-20210108185953543-1496512.png | Bin 7168 -> 0 bytes posts/4080/image-20210108185953543.png | Bin 7168 -> 0 bytes .../4080/image-20210108194827058-1496512.png | Bin 40233 -> 0 bytes posts/4080/image-20210108194827058.png | Bin 40233 -> 0 bytes .../4080/image-20210108195004831-1496512.png | Bin 37291 -> 0 bytes posts/4080/image-20210108195004831.png | Bin 37291 -> 0 bytes .../4080/image-20210108195751154-1496512.png | Bin 37701 -> 0 bytes posts/4080/image-20210108195751154.png | Bin 37701 -> 0 bytes .../4080/image-20210108201735637-1496512.png | Bin 39144 -> 0 bytes posts/4080/image-20210108201735637.png | Bin 39144 -> 0 bytes .../4080/image-20210108202013279-1496512.png | Bin 39144 -> 0 bytes posts/4080/image-20210108202013279.png | Bin 39144 -> 0 bytes .../4080/image-20210108202110208-1496512.png | Bin 35285 -> 0 bytes posts/4080/image-20210108202110208.png | Bin 35285 -> 0 bytes .../4080/image-20210108202315145-1496512.png | Bin 35807 -> 0 bytes posts/4080/image-20210108202315145.png | Bin 35807 -> 0 bytes .../4080/image-20210108203207681-1496512.png | Bin 33512 -> 0 bytes posts/4080/image-20210108203207681.png | Bin 33512 -> 0 bytes .../4080/image-20210108203346920-1496512.png | Bin 29676 -> 0 bytes posts/4080/image-20210108203346920.png | Bin 29676 -> 0 bytes .../4080/image-20210108214635693-1496512.png | Bin 49555 -> 0 bytes posts/4080/image-20210108214635693.png | Bin 49555 -> 0 bytes posts/4080/index.html | 10 +- posts/45670/index.html | 14 +- posts/54798/index.html | 10 +- posts/61252/image-20230605145850254.png | Bin 0 -> 59628 bytes posts/{62927 => 61252}/index.html | 117 +++-- posts/61255/index.html | 19 +- search.xml | 76 ++- sitemap.txt | 8 +- sitemap.xml | 36 +- tags/{CUDA => Lab}/index.html | 28 +- tags/cpp/index.html | 10 +- tags/data-structure/index.html | 10 +- tags/index.html | 12 +- tags/machine-learning/index.html | 10 +- tags/ocaml/index.html | 10 +- tags/rust/index.html | 10 +- tags/std-library/index.html | 10 +- 81 files changed, 845 insertions(+), 438 deletions(-) rename about/{index.html => disable_index.html} (96%) create mode 100644 archives/2023/06/index.html rename categories/{CUDA => Lab}/index.html (94%) create mode 100644 html/collection2023.html delete mode 100644 posts/4080/image-20210104212456443-1496512.png delete mode 100644 posts/4080/image-20210104212456443.png delete mode 100644 posts/4080/image-20210104215359261-1496512.png delete mode 100644 posts/4080/image-20210104215359261.png delete mode 100644 posts/4080/image-20210104221045493-1496512.png delete mode 100644 posts/4080/image-20210104221045493.png delete mode 100644 posts/4080/image-20210105004203912-1496512.png delete mode 100644 posts/4080/image-20210105004203912.png delete mode 100644 posts/4080/image-20210105004251316-1496512.png delete mode 100644 posts/4080/image-20210105004251316.png delete mode 100644 posts/4080/image-20210105004503695-1496512.png delete mode 100644 posts/4080/image-20210105004503695.png delete mode 100644 posts/4080/image-20210107195155968-1496512.png delete mode 100644 posts/4080/image-20210107195155968.png delete mode 100644 posts/4080/image-20210107195704276-1496512.png delete mode 100644 posts/4080/image-20210107195704276.png delete mode 100644 posts/4080/image-20210108183946379-1496512.png delete mode 100644 posts/4080/image-20210108183946379.png delete mode 100644 posts/4080/image-20210108184007479-1496512.png delete mode 100644 posts/4080/image-20210108184007479.png delete mode 100644 posts/4080/image-20210108184234026-1496512.png delete mode 100644 posts/4080/image-20210108184234026.png delete mode 100644 posts/4080/image-20210108185746717-1496512.png delete mode 100644 posts/4080/image-20210108185746717.png delete mode 100644 posts/4080/image-20210108185953543-1496512.png delete mode 100644 posts/4080/image-20210108185953543.png delete mode 100644 posts/4080/image-20210108194827058-1496512.png delete mode 100644 posts/4080/image-20210108194827058.png delete mode 100644 posts/4080/image-20210108195004831-1496512.png delete mode 100644 posts/4080/image-20210108195004831.png delete mode 100644 posts/4080/image-20210108195751154-1496512.png delete mode 100644 posts/4080/image-20210108195751154.png delete mode 100644 posts/4080/image-20210108201735637-1496512.png delete mode 100644 posts/4080/image-20210108201735637.png delete mode 100644 posts/4080/image-20210108202013279-1496512.png delete mode 100644 posts/4080/image-20210108202013279.png delete mode 100644 posts/4080/image-20210108202110208-1496512.png delete mode 100644 posts/4080/image-20210108202110208.png delete mode 100644 posts/4080/image-20210108202315145-1496512.png delete mode 100644 posts/4080/image-20210108202315145.png delete mode 100644 posts/4080/image-20210108203207681-1496512.png delete mode 100644 posts/4080/image-20210108203207681.png delete mode 100644 posts/4080/image-20210108203346920-1496512.png delete mode 100644 posts/4080/image-20210108203346920.png delete mode 100644 posts/4080/image-20210108214635693-1496512.png delete mode 100644 posts/4080/image-20210108214635693.png create mode 100644 posts/61252/image-20230605145850254.png rename posts/{62927 => 61252}/index.html (57%) rename tags/{CUDA => Lab}/index.html (93%) diff --git a/about/index.html b/about/disable_index.html similarity index 96% rename from about/index.html rename to about/disable_index.html index a53a9ac..2cf33bc 100644 --- a/about/index.html +++ b/about/disable_index.html @@ -18,22 +18,22 @@ - + - + - + @@ -359,7 +359,7 @@

BaiLan Life

-
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/archives/2021/index.html b/archives/2021/index.html index e9f9ee4..80fd851 100644 --- a/archives/2021/index.html +++ b/archives/2021/index.html @@ -18,7 +18,7 @@ @@ -359,7 +359,7 @@

BaiLan Life

-
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/archives/2022/11/index.html b/archives/2022/11/index.html index 309699a..e078e29 100644 --- a/archives/2022/11/index.html +++ b/archives/2022/11/index.html @@ -18,7 +18,7 @@ @@ -339,7 +339,7 @@

BaiLan Life

-
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/archives/2022/index.html b/archives/2022/index.html index 67616f6..cc8c028 100644 --- a/archives/2022/index.html +++ b/archives/2022/index.html @@ -18,7 +18,7 @@ @@ -339,7 +339,7 @@

BaiLan Life

-
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/archives/2023/05/index.html b/archives/2023/05/index.html index 93cf6d1..a9aaf90 100644 --- a/archives/2023/05/index.html +++ b/archives/2023/05/index.html @@ -18,7 +18,7 @@ @@ -227,26 +227,6 @@

BaiLan Life

- -
@@ -359,7 +339,7 @@

BaiLan Life

-
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/archives/2023/06/index.html b/archives/2023/06/index.html new file mode 100644 index 0000000..4742aab --- /dev/null +++ b/archives/2023/06/index.html @@ -0,0 +1,443 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Archive | BaiLan Life + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + + +
+ + + + + + + + +
+ +
+ +
+
+ + +
+ + 0% +
+
+ + +
+
+
+ + +
+ + + + + +
+
+
+ Um..! 5 posts in total. Keep on posting. +
+ + +
+ 2023 +
+ + + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/archives/2023/index.html b/archives/2023/index.html index 38d48df..95de4ff 100644 --- a/archives/2023/index.html +++ b/archives/2023/index.html @@ -18,7 +18,7 @@ @@ -212,15 +212,15 @@

BaiLan Life

-
@@ -232,15 +232,15 @@

BaiLan Life

-
@@ -359,7 +359,7 @@

BaiLan Life

-
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/archives/index.html b/archives/index.html index 5ae117c..4fc3349 100644 --- a/archives/index.html +++ b/archives/index.html @@ -18,7 +18,7 @@ @@ -212,15 +212,15 @@

BaiLan Life

-
@@ -232,15 +232,15 @@

BaiLan Life

-
@@ -425,7 +425,7 @@

BaiLan Life

-
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/baidusitemap.xml b/baidusitemap.xml index 0383bb2..d9b9651 100644 --- a/baidusitemap.xml +++ b/baidusitemap.xml @@ -1,8 +1,8 @@ - http://1330571.github.io/posts/62927/ - 2023-05-31 + http://1330571.github.io/posts/61252/ + 2024-03-03 http://1330571.github.io/posts/54798/ diff --git a/categories/CUDA/index.html b/categories/Lab/index.html similarity index 94% rename from categories/CUDA/index.html rename to categories/Lab/index.html index efb82f3..5c175b0 100644 --- a/categories/CUDA/index.html +++ b/categories/Lab/index.html @@ -18,20 +18,20 @@ - + - + - Category: CUDA | BaiLan Life + Category: Lab | BaiLan Life @@ -199,7 +199,7 @@

BaiLan Life

-

CUDA +

Lab Category

@@ -214,15 +214,15 @@

CUDA
-
@@ -340,7 +340,7 @@

CUDA -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/categories/MISC/index.html b/categories/MISC/index.html index 9f13b7d..9177e13 100644 --- a/categories/MISC/index.html +++ b/categories/MISC/index.html @@ -18,7 +18,7 @@ @@ -340,7 +340,7 @@

MISC -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/categories/index.html b/categories/index.html index 54b50cc..9b44433 100644 --- a/categories/index.html +++ b/categories/index.html @@ -18,7 +18,7 @@ @@ -223,7 +223,7 @@

categories 4 categories in total

@@ -340,7 +340,7 @@

categories -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/categories/ocaml/index.html b/categories/ocaml/index.html index 2a93170..3a82e4e 100644 --- a/categories/ocaml/index.html +++ b/categories/ocaml/index.html @@ -18,7 +18,7 @@ @@ -340,7 +340,7 @@

ocaml -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/categories/rust/index.html b/categories/rust/index.html index fd3abca..6ba5491 100644 --- a/categories/rust/index.html +++ b/categories/rust/index.html @@ -18,7 +18,7 @@ @@ -340,7 +340,7 @@

rust -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/css/main.css b/css/main.css index 13c64d0..9d079df 100644 --- a/css/main.css +++ b/css/main.css @@ -1,5 +1,5 @@ :root { - --body-bg-color: #eee; + --body-bg-color: #f5f7f9; --content-bg-color: #fff; --card-bg-color: #f5f5f5; --text-color: #555; @@ -18,6 +18,34 @@ --btn-default-hover-color: #fff; --btn-default-hover-border-color: #222; } +@media (prefers-color-scheme: dark) { + :root { + --body-bg-color: #282828; + --content-bg-color: #333; + --card-bg-color: #555; + --text-color: #ccc; + --blockquote-color: #bbb; + --link-color: #ccc; + --link-hover-color: #eee; + --brand-color: #ddd; + --brand-hover-color: #ddd; + --table-row-odd-bg-color: #282828; + --table-row-hover-bg-color: #363636; + --menu-item-bg-color: #555; + --btn-default-bg: #222; + --btn-default-color: #ccc; + --btn-default-border-color: #555; + --btn-default-hover-bg: #666; + --btn-default-hover-color: #ccc; + --btn-default-hover-border-color: #666; + } + img { + opacity: 0.75; + } + img:hover { + opacity: 0.9; + } +} html { line-height: 1.15; /* 1 */ -webkit-text-size-adjust: 100%; /* 2 */ @@ -1193,7 +1221,7 @@ pre .javascript .function { } .links-of-author a::before, .links-of-author span.exturl::before { - background: #747a88; + background: #2e95f2; border-radius: 50%; content: ' '; display: inline-block; @@ -2306,7 +2334,7 @@ mjx-container + br { .header-inner { background: var(--content-bg-color); border-radius: initial; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12); + box-shadow: initial; overflow: hidden; padding: 0; position: absolute; @@ -2339,7 +2367,7 @@ mjx-container + br { .content-wrap { background: var(--content-bg-color); border-radius: initial; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12); + box-shadow: initial; box-sizing: border-box; padding: 40px; width: calc(100% - 252px); @@ -2497,7 +2525,7 @@ mjx-container + br { .sidebar-inner { background: var(--content-bg-color); border-radius: initial; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12), 0 -1px 0.5px 0 rgba(0,0,0,0.09); + box-shadow: initial; box-sizing: border-box; color: var(--text-color); width: 240px; @@ -2581,127 +2609,3 @@ mjx-container + br { .links-of-blogroll-item { padding: 0; } -.content-wrap { - background: initial; - box-shadow: initial; - padding: initial; -} -.post-block { - background: var(--content-bg-color); - border-radius: initial; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12); - padding: 40px; -} -.post-block + .post-block { - border-radius: initial; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12), 0 -1px 0.5px 0 rgba(0,0,0,0.09); - margin-top: 12px; -} -.comments { - background: var(--content-bg-color); - border-radius: initial; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12), 0 -1px 0.5px 0 rgba(0,0,0,0.09); - margin-top: 12px; - padding: 40px; -} -.tabs-comment { - margin-top: 1em; -} -.content { - padding-top: initial; -} -.post-eof { - display: none; -} -.pagination { - background: var(--content-bg-color); - border-radius: initial; - border-top: initial; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12), 0 -1px 0.5px 0 rgba(0,0,0,0.09); - margin: 12px 0 0; - padding: 10px 0 10px; -} -.pagination .prev, -.pagination .next, -.pagination .page-number { - margin-bottom: initial; - top: initial; -} -.main { - padding-bottom: initial; -} -.footer { - bottom: auto; -} -.sub-menu { - border-bottom: initial; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12); -} -.sub-menu + .content .post-block { - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12), 0 -1px 0.5px 0 rgba(0,0,0,0.09); - margin-top: 12px; -} -@media (min-width: 768px) and (max-width: 991px) { - .sub-menu + .content .post-block { - margin-top: 10px; - } -} -@media (max-width: 767px) { - .sub-menu + .content .post-block { - margin-top: 8px; - } -} -.post-body h1, -.post-body h2 { - border-bottom: 1px solid #eee; -} -.post-body h3 { - border-bottom: 1px dotted #eee; -} -@media (min-width: 768px) and (max-width: 991px) { - .content-wrap { - padding: 10px; - } - .posts-expand .post-button { - margin-top: 20px; - } - .post-block { - border-radius: initial; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12), 0 -1px 0.5px 0 rgba(0,0,0,0.09); - padding: 20px; - } - .post-block + .post-block { - margin-top: 10px; - } - .comments { - margin-top: 10px; - padding: 10px 20px; - } - .pagination { - margin: 10px 0 0; - } -} -@media (max-width: 767px) { - .content-wrap { - padding: 8px; - } - .posts-expand .post-button { - margin: 12px 0; - } - .post-block { - border-radius: initial; - box-shadow: 0 2px 2px 0 rgba(0,0,0,0.12), 0 3px 1px -2px rgba(0,0,0,0.06), 0 1px 5px 0 rgba(0,0,0,0.12), 0 -1px 0.5px 0 rgba(0,0,0,0.09); - min-height: auto; - padding: 12px; - } - .post-block + .post-block { - margin-top: 8px; - } - .comments { - margin-top: 8px; - padding: 10px 12px; - } - .pagination { - margin: 8px 0 0; - } -} diff --git a/html/collection2023.html b/html/collection2023.html new file mode 100644 index 0000000..a857e68 --- /dev/null +++ b/html/collection2023.html @@ -0,0 +1,16 @@ + + + + + + + 2023统计 + + +

2023统计

+

本页面记录2023年一共做了多少事情

+

阅读

+

游戏

+

学习

+ + diff --git a/index.html b/index.html index 83a8356..3450b22 100644 --- a/index.html +++ b/index.html @@ -18,7 +18,7 @@ @@ -196,7 +196,7 @@

BaiLan Life

- +
-
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/posts/61255/index.html b/posts/61255/index.html index 4ddb901..589dc0c 100644 --- a/posts/61255/index.html +++ b/posts/61255/index.html @@ -18,7 +18,7 @@ @@ -311,10 +311,13 @@

-
+
+
-

@@ -427,7 +430,7 @@

© - 2023 + 2024 @@ -437,15 +440,15 @@

- 57k + 59k - 52 mins. + 53 mins.

-
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/search.xml b/search.xml index a53d027..8efb66e 100644 --- a/search.xml +++ b/search.xml @@ -1,5 +1,59 @@ + + MIT6.824 + /posts/61252/ + MIT6.824 Lab 学习笔记

[toc]

+

本篇记录自己学习MIT6.824的Lab记录,只记录思考过程,不记录具体的实现细节

+

环境

+
    +
  • WSL2 Ubuntu 22.04
  • +
  • Goland 最新版
  • +
  • Go 最新版
  • +
+

Lab1 - MapReduce

一. 测试原理窥探

首先观察test-mr.sh,也就是Lab1中提到的用以测试实现是否正确的文件。

+
maybe_quiet $TIMEOUT ../mrcoordinator ../pg*txt &
pid=$!

# give the coordinator time to create the sockets.
sleep 1

# start multiple workers.
(maybe_quiet $TIMEOUT ../mrworker ../../mrapps/wc.so) &
(maybe_quiet $TIMEOUT ../mrworker ../../mrapps/wc.so) &
(maybe_quiet $TIMEOUT ../mrworker ../../mrapps/wc.so) &

# wait for the coordinator to exit.
wait $pid
+ +

从此处可得知测试的原理是启动一个mrcoordinator 和数个mrworker,通过本机rpc调用的形式模拟分布式场景。

+

同时,测试会通过mrsequential生成正确的答案,要做的主要是修改rpc.go,worker.go,coordinator.go这几个文件,其余文件暂时不需要进行修改。

+

coordinator 文件中启动了rpc服务器,mrworker中根据命令行参数调用LoadPlugin加载.so文件中编译完成的map和reduce函数。在coordinator中,代码框架封装了一些网络通信的部分,其提供的call函数完成了参数的传递和回答的接收。

+

二. 运行原理及初期规划

顺序MapReduce模型

在Lab1的开始,指导中通过mrsequential生成正确的文件,我们先通过梳理mrsequential的方式逆推MapReduce的运行方式。

+

image-20230605145850254

+

可以看到,代码以顺序的方式对文件中的每个单词进行拆分,排序后,由Reduce函数负责计数,最终输出成一个文件作为结果,其中文件是每个单词的数量。

+

而我们要实现的版本就是并行的MapReduce模型,我们的Map和Reduce函数是不变的,但是File会分发给不同的Worker进行Map,Map完成后由Worker再进行Reduce,并输出成文件。

+

细节补充

mrsequential的代码非常简单的描述了MapReduce的工作流程,下面补充一些MapReduce的细节(详见原文mapreduce.pdf),本处只是简单提了一下论文中提到的重要信息。

+

Master结构

+
    +
  1. 存储所有任务(Map,Reduce)的状态,包括未开始、进行中、已完成
  2. +
  3. 中间结果的位置(location)和大小(size),并将结果推送给进行reduce任务的worker
  4. +
+

容错相关

+
    +
  1. Worker失效 —— Master会定期Ping每个Worker,无法回复Ping信号的Worker会被视作失败。同时将对应Worker的任务都重置为idle,同时因为每个Worker执行Map函数后会将文件存储在本地,因此完成的任务也需要重做。
  2. +
  3. Master失效 —— 可以通过Checkpoints恢复之前的进度,但是因为失效几率太低,所以论文之中没有实现。
  4. +
  5. 多个Worker同时完成一个任务时,他们会先将要输出的文件命名为一个临时文件,在Go中可以使用ioutil.TempFile,待完成任务后,原子性(atomically)的对文件进行重命名,确保只有一份正确的结果。
  6. +
+

可改善的细节

+
    +
  1. 分区,针对Map产生的Key进行分桶策略
  2. +
  3. 对中间结果进行Key排序
  4. +
  5. 对于部分有大量重复Key的,可以在分发Reduce之前进行部分合并
  6. +
  7. …详见论文
  8. +
+

规划Lab1

结合上面所述,我认为Lab1可以分为如下几个阶段进行实现:

+
    +
  • 基础通讯功能,包含workercoordinator请求任务,coordinator返回当前任务阶段等
  • +
  • 任务划分、进度收集功能,coordinator将任务分给worker并且回收结果
  • +
  • coordinator统筹整个流程,对于失败的任务进行再分发
  • +
+

实现

Coordinator

Worker

参考网络上的答案并进行反思

重构

]]> + + Lab + + + Lab + + LeetCode /posts/61255/ @@ -36,28 +90,6 @@
class Solution {
public:
bool canTraverseAllPairs(vector<int>& nums) {
//若A中集合可行遍
//B只需与A中任意一个集合可以行遍即可
vector<int> fa(1e5 + 1);
vector<int> sz(1e5 + 1);
for(int i = 0 ; i <= 1e5 ; ++i) fa[i] = i, sz[i] = 1;

std::function<int(int)> getFa = [&getFa,&fa](int x) {
if(fa[x] == x) return fa[x];
return fa[x] = getFa(fa[x]);
};

auto setFa = [&](int x,int y){
//cout << "setFa " << x << " " << y << endl;
int fa_x = getFa(x);
int fa_y = getFa(y);
if(fa_x != fa_y) {
fa[fa_x] = fa_y;
sz[fa_y] += sz[fa_x];
}
};

map<int,int> pos;
auto handle_num = [&](int factor,int index){
if(pos.count(factor) != 0) {
setFa(index, pos[factor]);
} else {
pos[factor] = index;
}
};
int idx{0};
for(auto & num : nums) {
//分解num
for(int x = 2; x * x <= num ; ++x) {
if(num % x == 0){
handle_num(x, idx);
num /= x;
while(num % x == 0) num /= x;
}
}
if(num > 1) handle_num(num, idx);
idx++;
}
return sz[getFa(0)] == nums.size();
}
};
]]>
- - CUDA学习 - /posts/62927/ - CUDA 简单学习笔记

CUDA 版本的 HELLO WORLD

-

执行的方式 Host Code -> Parallel Code -> Host Code -> Parallel Code

-

分为host和device,分别表示CPU及其内存和GPU及GPU内存

-

GPU和CPU结构图(图源 Nvidia Cuda Doc)

-

The GPU Devotes More Transistors to Data Processing

-

GPU有比CPU更多的单元,CPU负责串行程序、GPU负责并行程序

-

CUDA中的核函数可以通过 <<<grid, block>>> 的方式调用,每个GPU线程有个 thread ID

-

层级关系 Kernel -> Grid -> Block -> Thread

-

每个线程有自己的私有本地内存,还可以访问线程块的共享内存,GPU还有一块全局的全局内存。

-

线程有SM进行调度。

-

Dispatch -> Group -> Thead ID

-]]> - - CUDA - - - CUDA - - C++文件库实践 filesystem /posts/54798/ diff --git a/sitemap.txt b/sitemap.txt index bf427e8..bca4699 100644 --- a/sitemap.txt +++ b/sitemap.txt @@ -1,5 +1,5 @@ -http://1330571.github.io/posts/62927/ -http://1330571.github.io/about/index.html +http://1330571.github.io/about/disable_index.html +http://1330571.github.io/posts/61252/ http://1330571.github.io/posts/54798/ http://1330571.github.io/posts/4080/ http://1330571.github.io/posts/45670/ @@ -7,14 +7,14 @@ http://1330571.github.io/posts/61255/ http://1330571.github.io/tags/index.html http://1330571.github.io/categories/index.html http://1330571.github.io/ -http://1330571.github.io/tags/CUDA/ +http://1330571.github.io/tags/Lab/ http://1330571.github.io/tags/cpp/ http://1330571.github.io/tags/std-library/ http://1330571.github.io/tags/rust/ http://1330571.github.io/tags/machine-learning/ http://1330571.github.io/tags/ocaml/ http://1330571.github.io/tags/data-structure/ -http://1330571.github.io/categories/CUDA/ +http://1330571.github.io/categories/Lab/ http://1330571.github.io/categories/MISC/ http://1330571.github.io/categories/rust/ http://1330571.github.io/categories/ocaml/ diff --git a/sitemap.xml b/sitemap.xml index daa9b80..a081755 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,18 +2,18 @@ - http://1330571.github.io/posts/62927/ + http://1330571.github.io/about/disable_index.html - 2023-05-31 + 2024-03-12 monthly 0.6 - http://1330571.github.io/about/index.html + http://1330571.github.io/posts/61252/ - 2023-05-31 + 2024-03-03 monthly 0.6 @@ -76,57 +76,57 @@ http://1330571.github.io/ - 2023-05-31 + 2024-03-12 daily 1.0 - http://1330571.github.io/tags/CUDA/ - 2023-05-31 + http://1330571.github.io/tags/Lab/ + 2024-03-12 weekly 0.2 http://1330571.github.io/tags/cpp/ - 2023-05-31 + 2024-03-12 weekly 0.2 http://1330571.github.io/tags/std-library/ - 2023-05-31 + 2024-03-12 weekly 0.2 http://1330571.github.io/tags/rust/ - 2023-05-31 + 2024-03-12 weekly 0.2 http://1330571.github.io/tags/machine-learning/ - 2023-05-31 + 2024-03-12 weekly 0.2 http://1330571.github.io/tags/ocaml/ - 2023-05-31 + 2024-03-12 weekly 0.2 http://1330571.github.io/tags/data-structure/ - 2023-05-31 + 2024-03-12 weekly 0.2 @@ -134,29 +134,29 @@ - http://1330571.github.io/categories/CUDA/ - 2023-05-31 + http://1330571.github.io/categories/Lab/ + 2024-03-12 weekly 0.2 http://1330571.github.io/categories/MISC/ - 2023-05-31 + 2024-03-12 weekly 0.2 http://1330571.github.io/categories/rust/ - 2023-05-31 + 2024-03-12 weekly 0.2 http://1330571.github.io/categories/ocaml/ - 2023-05-31 + 2024-03-12 weekly 0.2 diff --git a/tags/CUDA/index.html b/tags/Lab/index.html similarity index 93% rename from tags/CUDA/index.html rename to tags/Lab/index.html index 3406c92..fe7ebf5 100644 --- a/tags/CUDA/index.html +++ b/tags/Lab/index.html @@ -18,20 +18,20 @@ - + - + - Tag: CUDA | BaiLan Life + Tag: Lab | BaiLan Life @@ -199,7 +199,7 @@

BaiLan Life

-

CUDA +

Lab Tag

@@ -214,15 +214,15 @@

CUDA
-
@@ -340,7 +340,7 @@

CUDA -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/tags/cpp/index.html b/tags/cpp/index.html index f1bc04c..cdebd5d 100644 --- a/tags/cpp/index.html +++ b/tags/cpp/index.html @@ -18,7 +18,7 @@ @@ -340,7 +340,7 @@

cpp -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/tags/data-structure/index.html b/tags/data-structure/index.html index 43c3e65..4751426 100644 --- a/tags/data-structure/index.html +++ b/tags/data-structure/index.html @@ -18,7 +18,7 @@ @@ -340,7 +340,7 @@

data structure -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/tags/index.html b/tags/index.html index 87b4718..f544569 100644 --- a/tags/index.html +++ b/tags/index.html @@ -18,7 +18,7 @@ @@ -223,7 +223,7 @@

tags 7 tags in total

@@ -340,7 +340,7 @@

tags -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/tags/machine-learning/index.html b/tags/machine-learning/index.html index 3cb8e45..f2a55f8 100644 --- a/tags/machine-learning/index.html +++ b/tags/machine-learning/index.html @@ -18,7 +18,7 @@ @@ -340,7 +340,7 @@

machine learning -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/tags/ocaml/index.html b/tags/ocaml/index.html index 04e4289..086a361 100644 --- a/tags/ocaml/index.html +++ b/tags/ocaml/index.html @@ -18,7 +18,7 @@ @@ -340,7 +340,7 @@

ocaml -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/tags/rust/index.html b/tags/rust/index.html index 79b6d2a..5bb20ab 100644 --- a/tags/rust/index.html +++ b/tags/rust/index.html @@ -18,7 +18,7 @@ @@ -340,7 +340,7 @@

rust -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces
diff --git a/tags/std-library/index.html b/tags/std-library/index.html index 4172286..7b162d4 100644 --- a/tags/std-library/index.html +++ b/tags/std-library/index.html @@ -18,7 +18,7 @@ @@ -340,7 +340,7 @@

std_library -
Powered by Hexo & NexT.Gemini +
Powered by Hexo & NexT.Pisces