<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hardware &#8211; richliu&#039;s blog</title>
	<atom:link href="https://richliu.com/category/computer/hardware/feed/" rel="self" type="application/rss+xml" />
	<link>https://richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Fri, 17 Oct 2025 02:46:40 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Build Master EDK2 for Altrad8ud</title>
		<link>https://richliu.com/2025/10/17/6433/build-master-edk2-for-altrad8ud/</link>
					<comments>https://richliu.com/2025/10/17/6433/build-master-edk2-for-altrad8ud/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 17 Oct 2025 02:30:02 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[ALTRAD8UD]]></category>
		<category><![CDATA[edk2]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=6433</guid>

					<description><![CDATA[<p>The previous article is the Ampere Altra Mt. Jade OpenB [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2025/10/17/6433/build-master-edk2-for-altrad8ud/">Build Master EDK2 for Altrad8ud</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>The previous article is the <a href="https://richliu.com/2022/06/23/4601/ampere-altra-mt-jade-openbmc-build-guide-on-arm64-platform/">Ampere Altra Mt. Jade OpenBMC and EDKII build guide on ARM64 platform</a>. It&#8217;s a kind of old article and is for Mt. Jade, not for Altrad8ud. <br />Rebecca committed the Altrad8ud support for EDK2 several months ago. I&#8217;ll just update some procedures and the git tree addresses.</p>



<p>OS: ubuntu 24.04</p>



<span id="more-6433"></span>



<p>Install necessary packages</p>



<pre class="wp-block-code"><code>sudo apt update
sudo apt-get install -y build-essential chrpath cpio debianutils diffstat gawk git iputils-ping libdata-dumper-simple-perl liblz4-tool libsdl1.2-dev libthread-queue-any-perl locales python3 socat subversion texinfo wget zstd
sudo apt-get install -y uuid-dev acpica-tools</code></pre>



<p>If want to compile it on x86 platform, it needs to install cross compiler gcc</p>



<pre class="wp-block-code"><code>sudo apt install gcc-aarch64-linux-gnu
export GCC_AARCH64_PREFIX=aarch64-linux-gnu-</code></pre>



<p>Download git source code </p>



<pre class="wp-block-code"><code>export WORKSPACE=/nvme/tianocore
mkdir -p $WORKSPACE
cd $WORKSPACE
git clone https://github.com/tianocore/edk2.git
cd edk2
git submodule update --init
cd ..

git clone https://github.com/tianocore/edk2-platforms.git
cd edk2-platforms
git submodule update --init
cd ..
git clone https://github.com/tianocore/edk2-non-osi.git

git clone https://github.com/AmpereComputing/edk2-ampere-tools.git

git clone --depth 1 https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git</code></pre>



<p>Setup the environment, first time, it needs to run the script in the edk2 directory</p>



<pre class="wp-block-code"><code>make -C edk2/BaseTools
cd edk2
. edksetup.sh</code></pre>



<p>then it should run it again on &lt;WORKSPACE></p>



<pre class="wp-block-code"><code>cd $WORKSPACE
. edk2/edksetup.sh</code></pre>



<p>Build ARM ATF</p>



<pre class="wp-block-code"><code>cd $WORKSPACE
cd trusted-firmware-a                                                                        
make fiptool  
make certtool  </code></pre>



<p>add those parameters to your environment file and source it.</p>



<pre class="wp-block-preformatted">export WORKSPACE=/nvme/tianocore<br />export PACKAGES_PATH=$PWD/edk2:$PWD/edk2-platforms:$PWD/edk2-non-osi:$PWD/edk2-platforms/Features<br />ATFPATH=$WORKSPACE<br />export MANUFACTURER=ASRockRack<br />export BOARD_NAME=Altra1L2T<br />export PATH=$PATH:$ATFPATH/AtfTools/tools/cert_create:$ATFPATH/AtfTools/tools/fiptool</pre>



<p>Build the edk2 </p>



<pre class="wp-block-code"><code># build release version
./edk2-platforms/Platform/Ampere/buildfw.sh -m ASRockRack -p Altra1L2T -b RELEASE
# build debug version 
./edk2-platforms/Platform/Ampere/buildfw.sh -m ASRockRack -p Altra1L2T -b DEBUG
# Change default parameters
EDK2_X86_EMULATOR_ENABLE=FALSE EDK2_SHELL_ENABLE=TRUE ./edk2-platforms/Platform/Ampere/buildfw.sh -m ASRockRack -p Altra1L2T -b RELEASE</code></pre>



<p>Detail parameres can be seen in the build_fw.sh file</p>



<pre class="wp-block-code"><code>./edk2-platforms/Platform/Ampere/buildfw.sh  --help
Usage:
  ./edk2-platforms/Platform/Ampere/buildfw.sh &#91;options]

Options:
  -b &lt;bldtype&gt;, --build &lt;bldtype&gt;  Specify the build type: DEBUG or RELEASE
  -t &lt;tc&gt;, --toolchain &lt;tc&gt;        Specify the toolchain to use: GCC or CLANG
  -m &lt;mfg&gt;, --manufacturer &lt;mfg&gt;   Specify platform manufacturer (e.g. Ampere)
  -p &lt;plat&gt;, --platform &lt;plat&gt;     Specify platform to build (e.g. Jade)
  -l &lt;kern&gt;, --linuxboot &lt;kern&gt;    Build LinuxBoot firmware instead of full EDK2 with UEFI Shell, specifying path to flashkernel
  -f, --flash                      Copy firmware to BMC and flash firmware (keeping EFI variables and NVPARAMs) after building
  -F, --full-flash                 Copy firmware to BMC and flash full EEPROM (resetting EFI variables and NVPARAMs) after building

  Note: flash options require bmc.sh file with env vars BMC_HOST, BMC_USER and BMC_PASS defined

  Available manufacturers:
    ADLINK
    Ampere
    ASRockRack

  Available platforms:
    ADLINK     -&gt; ComHpcAlt
    Ampere     -&gt; Jade
    ASRockRack -&gt; Altra1L2Q
    ASRockRack -&gt; Altra1L2T

Environment Variables:
  SECUREBOOT_DIR       - directory to store SecureBoot keys, certs etc.
  USE_EXISTING_SB_KEYS - use existing Secure Boot Platform and Update keys
  DOWNLOAD_MS_SB_KEYS  - force re-download of Microsoft Secure Boot KEK and DB certificates
  CERT_PASSWORD        - password to use when generating Platform and Update Keys and certificates
                         defaults to "password" if not specified.

  EDK2_SECURE_BOOT_ENABLE             (TRUE)
  EDK2_NETWORK_ENABLE                 (TRUE)
  EDK2_INCLUDE_TFTP_COMMAND           (TRUE)
  EDK2_NETWORK_IP6_ENABLE             (TRUE)
  EDK2_NETWORK_ALLOW_HTTP_CONNECTIONS (FALSE)
  EDK2_NETWORK_TLS_ENABLE             (TRUE)
  EDK2_REDFISH_ENABLE                 (TRUE)
  EDK2_PERFORMANCE_MEASUREMENT_ENABLE (FALSE)
  EDK2_TPM2_ENABLE                    (TRUE)
  EDK2_HEAP_GUARD_ENABLE              (FALSE)
  EDK2_X86_EMULATOR_ENABLE            (TRUE)
  EDK2_SHELL_ENABLE                   (TRUE)</code></pre>



<p>If build_fw.sh run&#8217;s without any problem, it will generate a 10MB size BIOS image, but the stock ASRR image size is 32MB. Therefore, you needs to copy the EDK2 image into the stock image at offset 0x600000. You can download the Altrad8ud stock firmware from the Altrad8ud firmware download site.</p>



<pre class="wp-block-code"><code>dd if=edk2-uefi.bin of=stock-bios.bin bs=1MB seek=6 conv=notrunc</code></pre>



<p>Here is a sample script to package it again. It will generate fw-altrad8ud.tar, which can be upgraded via the WebGUI.</p>



<pre class="wp-block-code"><code>cp ampere/bios.bin .
cp ampere/MANIFEST .

dd if=Build/Altra1L2T/altra1l2t_uefi.bin of=bios.bin bs=1M seek=6 conv=notrunc

tar cf fw-altrad8ud.tar bios.bin MANIFEST</code></pre>



<p>Or you also can  copy bios.bin(modified) to the BMC and update it directly from the BMC. <br />because scp or sftp didn&#8217;t work for me, I used the http to download the image.</p>



<pre class="wp-block-code"><code># cd /tmp
# curl &lt;your web&gt;/bios.bin
# ampere_flash_bios.sh bios.bin</code></pre>



<p>ref. <a href="https://community.amperecomputing.com/t/edk2-new-support-for-asrock-rack-altrad8ud-1l2t-altrad8ud2-1l2q-and-build-improvements-for-mt-jade-and-com-hpc-alt/2969" target="_blank" rel="noopener">EDK2: new support for ASRock Rack ALTRAD8UD-1L2T / ALTRAD8UD2-1L2Q and build improvements for Mt Jade and COM-HPC-ALT</a></p>



<p></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2025/10/17/6433/build-master-edk2-for-altrad8ud/">Build Master EDK2 for Altrad8ud</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2025/10/17/6433/build-master-edk2-for-altrad8ud/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Run verilog Program on Lattice ECP5 Versa with OpenSource Tools</title>
		<link>https://richliu.com/2025/10/11/6424/run-verilog-program-on-lattice-ecp5-versa-with-opensource-tools/</link>
					<comments>https://richliu.com/2025/10/11/6424/run-verilog-program-on-lattice-ecp5-versa-with-opensource-tools/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 11 Oct 2025 15:37:56 +0000</pubDate>
				<category><![CDATA[IC Design]]></category>
		<category><![CDATA[RiscV]]></category>
		<category><![CDATA[ECP5]]></category>
		<category><![CDATA[FPGA]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=6424</guid>

					<description><![CDATA[<p>其實也不是我願意這樣做，Lattice Diamond 明明支援我手上的 FPGA ，實際上就是找不到我這一塊 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2025/10/11/6424/run-verilog-program-on-lattice-ecp5-versa-with-opensource-tools/">Run verilog Program on Lattice ECP5 Versa with OpenSource Tools</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>其實也不是我願意這樣做，Lattice Diamond 明明支援我手上的 FPGA ，實際上就是找不到我這一塊 ECP5 Versa Board ，IC 型是 LFE5UM-45F ，而 Lattice Diamond 只支援 LEF5U-45F 。</p>



<p>所以只能用之前的 Open Source 開發環境編 Verilog 程式。首先請參照<a href="https://richliu.com/2025/08/27/6391/build-risc-v-on-ubuntu-linux/">Build Risc-V on Ubuntu Linux</a>設定開發環境</p>



<span id="more-6424"></span>



<p>最難的部份是找到 FPGA 的 clock input pin ，每一家 LLM 給的值都是錯的。實際上就是 User Manual 以下這段，不過我找到是從 litex-board 抓出來才知道原來是這一段，給個 table 啊，這文件不行，其它的 LED dip switch 都給了，clock 不給.</p>



<pre class="wp-block-preformatted">An on-board 100 MHz LVDS oscillator is provided for general purpose use. This clock source is connected to differential inputs P3 and P4 and must be used as LVDS inputs to the FPGA. This pin pair also provides optimal interface to the FPGA PLL for customized use.</pre>



<p>P3 and P4 pin 利用 LVDS 當 input. 這樣就可以寫 lpf 檔案，只能能抓出 clk ，而且知道FPGA ball number 要跟 verilog 對應。這樣就可以將LED 也抓進來了<br />而且看起來目前 FPGA 主要就是靠這兩根 pin 做 clk  輸入，100Mhz，如果是當 PCIe device 時也可以從 PCIe 那邊接 PCIe 的 clock 進來</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1636" height="466" src="https://richliu.com/wp-content/uploads/2025/10/image.png" alt="" class="wp-image-6425" srcset="https://richliu.com/wp-content/uploads/2025/10/image.png 1636w, https://richliu.com/wp-content/uploads/2025/10/image-600x171.png 600w, https://richliu.com/wp-content/uploads/2025/10/image-768x219.png 768w, https://richliu.com/wp-content/uploads/2025/10/image-1536x438.png 1536w, https://richliu.com/wp-content/uploads/2025/10/image-816x232.png 816w" sizes="(max-width: 1636px) 100vw, 1636px" /></figure>



<p>接下來我們就可以編 mapping file ，像是 ecp5evn.lpf 內容如下</p>



<pre class="wp-block-preformatted">LOCATE COMP "clk100" SITE "P3";<br />IOBUF PORT "clk100" IO_TYPE=LVDS;<br /><br /><br />LOCATE COMP "rst" SITE "H2";<br />IOBUF PORT "rst" IO_TYPE=LVCMOS33 PULLMODE=DOWN;<br /><br /># 將 Verilog 中的 "led" port 定位到 FPGA 的 LED output<br />LOCATE COMP "led[0]" SITE "F16";<br />IOBUF PORT "led[0]" IO_TYPE=LVCMOS33;<br />LOCATE COMP "led[1]" SITE "E17";<br />IOBUF PORT "led[1]" IO_TYPE=LVCMOS33;<br />LOCATE COMP "led[2]" SITE "F18";<br />IOBUF PORT "led[2]" IO_TYPE=LVCMOS33;<br />LOCATE COMP "led[3]" SITE "F17";<br />IOBUF PORT "led[3]" IO_TYPE=LVCMOS33;<br />LOCATE COMP "led[4]" SITE "E18";<br />IOBUF PORT "led[4]" IO_TYPE=LVCMOS33;<br />LOCATE COMP "led[5]" SITE "D18";<br />IOBUF PORT "led[5]" IO_TYPE=LVCMOS33;<br />LOCATE COMP "led[6]" SITE "D17";<br />IOBUF PORT "led[6]" IO_TYPE=LVCMOS33;<br />LOCATE COMP "led[7]" SITE "E16";<br />IOBUF PORT "led[7]" IO_TYPE=LVCMOS33;<br /></pre>



<p>然後寫一個簡單的 verilog 程式驗證我們的 code 是不是對的，像是一顆簡單的 CPU，然後寫了一個簡單的程式計算 1+10 </p>



<pre class="wp-block-code"><code>module aCPU (
    input  clk,   
    input  rst,
    output reg &#91;7:0] led,    // LED output
    output reg &#91;7:0] debug_led    // LED output
);
    // command
    parameter OP_NOP = 4'b0000   ;
    parameter OP_LI  = 4'b0001   ;
    parameter OP_ADD = 4'b0010   ;
    parameter OP_ADDI= 4'b0011   ; // copy s_reg + imm &#91;1:0] reg to d_reg
    parameter OP_BNER0 = 4'b0100   ;
    parameter OP_OUT = 4'b0101   ;
    parameter OP_HALT = 4'b0110   ;
    reg &#91;3:0] pc;
    reg &#91;7:0] register &#91;0:3];
    reg &#91;15:0] ir;   // ir = 指令暫存

    wire &#91;3:0] opcode /* verilator public */ = ir&#91;15:12];
    wire &#91;1:0] s_reg  = ir&#91;11:10];
    wire &#91;1:0] d_reg  = ir&#91;9:8];
    wire &#91;7:0] value  = ir&#91;7:0];

    reg &#91;15:0] program_memory &#91;0:15];


    // 初始化程式記憶體
    initial begin
        // 程式: 計算 1 + 10 並輸出
        program_memory&#91;0] = {OP_LI, 2'b00, 2'b00, 8'd1};    // LI only load to d_REG. s_reg no work
        program_memory&#91;1] = {OP_LI, 2'b01, 2'b01, 8'd11};   //
        program_memory&#91;2] = {OP_ADDI, 2'b10, 2'b10, 8'b0000}; // R3 = R2 + IMM
        program_memory&#91;3] = {OP_ADD, 2'b00, 2'b00, 8'b0001}; // R2 = R0 + IMM => R0
        program_memory&#91;4] = {OP_BNER0, 2'b00, 2'b01,8'b00000010}; // R0 跟 R1 比若不相同跳到 2
        program_memory&#91;5] = {OP_OUT,  2'b10, 2'b00, 8'b00000000}; // 輸出 s_reg to serial
        program_memory&#91;6] = {OP_HALT, 2'b10, 2'b01, 8'b00000000};     // 停止
    end
    always @(posedge clk or posedge rst) begin
        if (rst) begin
            pc &lt;= 0;
            register&#91;0] &lt;= 0;
            register&#91;1] &lt;= 0;
            register&#91;2] &lt;= 0;
            register&#91;3] &lt;= 0;
            led &lt;= 8'b11111111;
            debug_led &lt;= 8'b11111111;
        end
        else begin
            pc &lt;= pc + 1;
            ir &lt;= program_memory&#91;pc];
            // $display("pc&#91;%d] ir:%x reg&#91;0]:%d reg&#91;1]:%d reg&#91;2]:%d value: %x \n", pc, ir, register&#91;0], register&#91;1], register&#91;2], value);
            case (opcode)
                 OP_NOP: begin
                 end
                 OP_LI: begin
                    register&#91;s_reg] &lt;= value;
                 end
                 OP_ADD: begin
                    register&#91;d_reg] &lt;= register&#91;s_reg] + value;
                 end
                 OP_ADDI: begin
                    register&#91;d_reg] &lt;= register&#91;s_reg] + register&#91;value&#91;1:0]];
                 end
                 OP_BNER0: begin
                    if (register&#91;s_reg] != register&#91;d_reg]) begin
                        pc &lt;= value&#91;3:0];
                    end
                 end
                 OP_OUT: begin
                    led &lt;= register&#91;s_reg];
                 end
                 OP_HALT: begin
                    pc &lt;= pc - 1;
                 end
                 default: begin
                    // $display("Error No this command OP_CODE: %x ir: %x ", opcode, ir);
                 end
            endcase
        end
    end
endmodule</code></pre>



<p>當然為了這個程式就需要寫一個 test bench 檔案，就叫 ${PRJNAME}_tb.cpp <br />這不僅僅是當 test bench ，後來在弄的過程才知道可以靠 $display 顯示電路內的狀態，比幻想簡單太多了</p>



<pre class="wp-block-code"><code>#include &lt;stdio.h>
#include &lt;stdlib.h>
#include &lt;assert.h>
#include "VsCPU.h"
#include "verilated.h"

#include "verilated_vcd_c.h"

int main (int argc, char** argv, char** env){

    VerilatedContext* contextp = new VerilatedContext;
    contextp->commandArgs(argc, argv);
    VsCPU* top = new VsCPU{contextp};

    VerilatedVcdC* tfp = new VerilatedVcdC;
    contextp->traceEverOn(true); // open trace function
    top->trace(tfp, 99);
    tfp->open("wave.vcd");
    int clk = 0;

    int cycles = 0;
    while (!contextp->gotFinish() &amp;&amp; (cycles &lt; 100) ) {
      clk = !clk;
      top->clk100 = clk;
      top->eval();
      tfp->dump(contextp->time()); // dump wave
      contextp->timeInc(1); // move time to next clock

      if (cycles > 50) {
          // 檢查 LED 輸出是否為預期值 (1 + 10 = 11)
          if (top->led == (u_int8_t) ~0xc8) {
              printf("SUCCESS: 1 + 10 = %d\n", top->led);
              break;
          }
      }
      cycles++;
      if (cycles >= 99) {
          printf("TIMEOUT: Expected result not reached\n");
      }

    }
    //
    if (tfp) {
        tfp->close();
        delete tfp;
    }
    delete top;
    return 0;
}
</code></pre>



<p>然後撰寫一個 Makefile ，可以直接 Compile Code 變 bitstream 而且可以上傳到 FPGA 上.</p>



<pre class="wp-block-preformatted">DEVICE = um-45k<br />PACKAGE = CABGA381<br /><br />PRJNAME=aCPU<br /><br />all: ${PRJNAME}.bit<br /><br />${PRJNAME}.json: ${PRJNAME}.v<br />        yosys -p "synth_ecp5 -json ${PRJNAME}.json" ${PRJNAME}.v<br /><br />${PRJNAME}_out.config: ${PRJNAME}.json<br />        nextpnr-ecp5 --$(DEVICE) --package $(PACKAGE) --json ${PRJNAME}.json \<br />        --lpf ecp5evn.lpf --textcfg ${PRJNAME}_out.config<br /><br />${PRJNAME}.bit: ${PRJNAME}_out.config<br />        ecppack --svf ${PRJNAME}.svf ${PRJNAME}_out.config ${PRJNAME}.bit<br /><br />sim:<br />        verilator -Wall --cc --exe --build --trace ${PRJNAME}.v ${PRJNAME}_tb.cpp<br /><br />program:<br />        openFPGALoader -b ecp5_evn ${PRJNAME}.bit<br /><br />clean:<br />        rm -f *.json *.config *.bit *.svf</pre>



<p>make sim 之後執行 ./obj_dir/VaCPU 就可以看到程式輸出的結果，果然還是印出來比較簡單 debug</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1174" height="769" src="https://richliu.com/wp-content/uploads/2025/10/image-1.png" alt="" class="wp-image-6426" srcset="https://richliu.com/wp-content/uploads/2025/10/image-1.png 1174w, https://richliu.com/wp-content/uploads/2025/10/image-1-600x393.png 600w, https://richliu.com/wp-content/uploads/2025/10/image-1-768x503.png 768w, https://richliu.com/wp-content/uploads/2025/10/image-1-816x535.png 816w" sizes="(max-width: 1174px) 100vw, 1174px" /></figure>



<p>同時也會產生 wave.vcd  這時可以用 gtkwave 看波形</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1236" height="834" src="https://richliu.com/wp-content/uploads/2025/10/image-2.png" alt="" class="wp-image-6427" srcset="https://richliu.com/wp-content/uploads/2025/10/image-2.png 1236w, https://richliu.com/wp-content/uploads/2025/10/image-2-600x405.png 600w, https://richliu.com/wp-content/uploads/2025/10/image-2-768x518.png 768w, https://richliu.com/wp-content/uploads/2025/10/image-2-816x551.png 816w" sizes="(max-width: 1236px) 100vw, 1236px" /></figure>



<p>make program 之後就可以燒到 FPGA 板子上啦，輸出的燈號是反向的</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1280" height="960" src="https://richliu.com/wp-content/uploads/2025/10/image-3.png" alt="" class="wp-image-6428" srcset="https://richliu.com/wp-content/uploads/2025/10/image-3.png 1280w, https://richliu.com/wp-content/uploads/2025/10/image-3-600x450.png 600w, https://richliu.com/wp-content/uploads/2025/10/image-3-768x576.png 768w, https://richliu.com/wp-content/uploads/2025/10/image-3-816x612.png 816w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></figure>
<p>The post <a rel="nofollow" href="https://richliu.com/2025/10/11/6424/run-verilog-program-on-lattice-ecp5-versa-with-opensource-tools/">Run verilog Program on Lattice ECP5 Versa with OpenSource Tools</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2025/10/11/6424/run-verilog-program-on-lattice-ecp5-versa-with-opensource-tools/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Running Risc-V Linux on Lattice Versa ECP5 EVB</title>
		<link>https://richliu.com/2025/09/21/6411/running-risc-v-linux-on-lattice-versa-ecp5-evb/</link>
					<comments>https://richliu.com/2025/09/21/6411/running-risc-v-linux-on-lattice-versa-ecp5-evb/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sun, 21 Sep 2025 06:50:27 +0000</pubDate>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[IC Design]]></category>
		<category><![CDATA[RiscV]]></category>
		<category><![CDATA[ECP5]]></category>
		<category><![CDATA[FPGA]]></category>
		<category><![CDATA[Linux-on-lite-vexriscv]]></category>
		<category><![CDATA[LiteX]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=6411</guid>

					<description><![CDATA[<p>大部份的環境都要用上一篇(Build Risc-V on Ubuntu Linux)相同的環境，但是其實還有更 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2025/09/21/6411/running-risc-v-linux-on-lattice-versa-ecp5-evb/">Running Risc-V Linux on Lattice Versa ECP5 EVB</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>大部份的環境都要用上一篇(<a href="https://richliu.com/2025/08/27/6391/build-risc-v-on-ubuntu-linux/">Build Risc-V on Ubuntu Linux</a>)相同的環境，但是其實還有更多的問題，中間也踩了不少地雷，還好都不算難解的問題</p>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#lattice-versa-evb-board-晶片型號不同">Lattice Versa EVB Board 晶片型號不同</a></li><li><a href="#連接上-evb-board">連接上 EVB Board</a></li><li><a href="#燒錄-bitstream-到板子上">燒錄 bitstream 到板子上</a></li><li><a href="#設定-udev">設定 udev</a></li></ul></nav></div>



<span id="more-6411"></span>



<h3 class="wp-block-heading" id="lattice-versa-evb-board-晶片型號不同">Lattice Versa EVB Board 晶片型號不同</h3>



<p>這個是最主要的問題，因為文件並不會提到這件事，都會用 versa_ecp5 帶過，但是實際上 versa_ecp5 是使用 LFE5UM5G-85F 的晶片，晶片比較新，邏輯閘數也比較多。一般市面上賣的 versa_ecp5 是 LFE5UM5G-45F，一片約在一萬元左右。<br />我從淘寶看到一塊比較便宜的 LFE5UM5G-45F ，結果買回來後是 LFE5UM-45F ，沒有 5G。查詢網路上的資料，大概只差在 SEDERS 最高頻可以到 5G ，還有速度比較快。</p>



<p>但是 LiteX default versa_ecp5 是預設用 LFE5UM5G-85F ，在燒錄時就會失敗，ID 不一樣</p>



<p>此時我們就要重編一次 Linux-on-litex-vexriscv ，加上 device 的參數，這樣就可以了</p>



<pre class="wp-block-code"><code>./make.py --device LFE5UM --board=versa_ecp5 --cpu-count=1 --build</code></pre>



<p>編出來的 bitstream 和 fpga hardware 不同的錯誤訊息，可以看到 hardware id 不一樣</p>



<pre class="wp-block-preformatted">$ openFPGALoader -b ecp5_evn versa_ecp5.bit<br />empty<br />Jtag frequency : requested 6.00MHz    -&gt; real 6.00MHz<br />Open file: DONE<br />b3bdffff<br />Parse file: DONE<br />mismatch between target's idcode and bitstream idcode<br />        bitstream has <strong>0x81112043 </strong>hardware requires <strong>0x01112043</strong><br />Error: Failed to program FPGA: std::exception</pre>



<h3 class="wp-block-heading" id="連接上-evb-board">連接上 EVB Board </h3>



<p>EVB Board 應該支援 ethernet load ，但是我還沒試出來，就當 TBD 吧，看設定檔內 ethernet 是可以用的</p>



<p>EVB Board 上的 FT2232H 支援 JTAG 和 Serial Port ，Linux kernel 的 image 可以從 serial port load，不過速度好慢啊</p>



<p>我之前用 Diamond programmer 要燒錄編出來的 bitstream file ，但是因為 id mismatch 的關係所以燒不上去，所以我最後是找了一台乾淨的 Linux 直接接 EVB Board 的 USB （要注意，這塊版子的 USB Port 是 mini-USB ，如果沒附線要有支援 mini-USB 的線），就這樣找到最後才發現根本型號不一樣，所以這篇就不會提到 Diamond programmer</p>



<p>記得接上之前要將 FTDI 的J50跳線改成下圖這樣，要跳過 iSPclock </p>



<p>（原文 <strong>Note</strong>: If you are using a Versa board, you will need to change J50 to bypass the iSPclock. Re-arrange the jumpers to connect pins 1-2 and 3-5 (leaving one jumper spare). See p19 of the Versa Board user guide.）</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="699" height="627" src="https://richliu.com/wp-content/uploads/2025/09/image.png" alt="" class="wp-image-6412" srcset="https://richliu.com/wp-content/uploads/2025/09/image.png 699w, https://richliu.com/wp-content/uploads/2025/09/image-600x538.png 600w" sizes="auto, (max-width: 699px) 100vw, 699px" /></figure>



<p>接上去之後，上電之後，Linux 下會出現 /dev/ttyUSB0 是 JTAG 的介面，/dev/ttyUSB1 是 serial port 的介面</p>



<p>在另一個視窗先執行 litex_term（記得在 venv 環境下執行）</p>



<pre class="wp-block-code"><code>litex_term --images=images/boot.json /dev/ttyUSB1</code></pre>



<h3 class="wp-block-heading" id="燒錄-bitstream-到板子上">燒錄 bitstream 到板子上</h3>



<p>最後一步就是燒錄上去了，我是用 OpenFPGAloader ，以下是安裝步驟</p>



<pre class="wp-block-code"><code>sudo apt install -y  libftdi1-dev

cd /nvme/cpu
git clone https://github.com/trabucayre/openFPGALoader
cd openFPGALoader
mkdir -p build
cd build
cmake ../
make -j `nproc`
sudo make install </code></pre>



<p>然後到 linux-on-litex-vexriscv 下用 OpenFPGAloader 暫時 load bitstream 上去，這速度很快，這樣就不用燒上去了</p>



<pre class="wp-block-code"><code>cd /nvme/cpu/linux-on-litex-vexriscv/build/versa_ecp5/gateware
$ openFPGALoader -b ecp5_evn versa_ecp5.bit
empty
Jtag frequency : requested 6.00MHz    -&gt; real 6.00MHz
Open file: DONE
b3bdffff
Parse file: DONE
Enable configuration: DONE
SRAM erase: DONE
Loading: &#91;==================================================] 100.00%
Done
Disable configuration: DONE</code></pre>



<p>如果順利，可以在剛剛執行 litex_term 上看到 load image 訊息<br />如果用的是上一篇文章內提到的先下載好 RiscV 的 Linux image 和 rootfs ，就可以看到 Linux boot 了</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="943" height="927" src="https://richliu.com/wp-content/uploads/2025/09/image-1.png" alt="" class="wp-image-6413" srcset="https://richliu.com/wp-content/uploads/2025/09/image-1.png 943w, https://richliu.com/wp-content/uploads/2025/09/image-1-600x590.png 600w, https://richliu.com/wp-content/uploads/2025/09/image-1-768x755.png 768w, https://richliu.com/wp-content/uploads/2025/09/image-1-88x88.png 88w, https://richliu.com/wp-content/uploads/2025/09/image-1-816x802.png 816w" sizes="auto, (max-width: 943px) 100vw, 943px" /></figure>



<p>這年代可以自己編一顆 CPU 跑起來也真的是很有趣</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1353" height="927" src="https://richliu.com/wp-content/uploads/2025/09/image-2.png" alt="" class="wp-image-6414" srcset="https://richliu.com/wp-content/uploads/2025/09/image-2.png 1353w, https://richliu.com/wp-content/uploads/2025/09/image-2-600x411.png 600w, https://richliu.com/wp-content/uploads/2025/09/image-2-768x526.png 768w, https://richliu.com/wp-content/uploads/2025/09/image-2-816x559.png 816w" sizes="auto, (max-width: 1353px) 100vw, 1353px" /></figure>



<p>以下未完成，待續</p>



<h3 class="wp-block-heading" id="設定-udev">設定 udev</h3>



<p>這塊版子看起來要設定過 udev 才能被 LiteX 抓到，首先新增檔案 /etc/udev/rules.d/99-ftdi.rules<br />內容如下，記得 GROUP=換成 Linux login 帳號</p>



<pre class="wp-block-preformatted">SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0660", GROUP="使用者名稱"</pre>



<p>然後執行以下命令之後再重新上電即可</p>



<pre class="wp-block-code"><code>sudo udevadm control --reload-rules
sudo udevadm trigger</code></pre>



<p>這個命令也可以像 OpenFPGAloader 一樣將 bitstream load 到 FPGA 上</p>



<pre class="wp-block-code"><code>./make.py --device LFE5UM --board=versa_ecp5 --cpu-count=1 --load </code></pre>



<p>45F Gate count 夠放二顆 CPU ，所以可以跑 SMP</p>



<pre class="wp-block-code"><code>./make.py --device LFE5UM --board=versa_ecp5 --cpu-count=2 --build
./make.py --device LFE5UM --board=versa_ecp5 --cpu-count=2 --load </code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1299" height="1033" src="https://richliu.com/wp-content/uploads/2025/09/image-3.png" alt="" class="wp-image-6418" srcset="https://richliu.com/wp-content/uploads/2025/09/image-3.png 1299w, https://richliu.com/wp-content/uploads/2025/09/image-3-600x477.png 600w, https://richliu.com/wp-content/uploads/2025/09/image-3-768x611.png 768w, https://richliu.com/wp-content/uploads/2025/09/image-3-816x649.png 816w" sizes="auto, (max-width: 1299px) 100vw, 1299px" /></figure>
<p>The post <a rel="nofollow" href="https://richliu.com/2025/09/21/6411/running-risc-v-linux-on-lattice-versa-ecp5-evb/">Running Risc-V Linux on Lattice Versa ECP5 EVB</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2025/09/21/6411/running-risc-v-linux-on-lattice-versa-ecp5-evb/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Build Risc-V on Ubuntu Linux</title>
		<link>https://richliu.com/2025/08/27/6391/build-risc-v-on-ubuntu-linux/</link>
					<comments>https://richliu.com/2025/08/27/6391/build-risc-v-on-ubuntu-linux/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 27 Aug 2025 13:04:18 +0000</pubDate>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[IC Design]]></category>
		<category><![CDATA[RiscV]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=6391</guid>

					<description><![CDATA[<p>打算弄個 Risc-V 做個自己的小 Project ，摸了一下大概才知道怎麼入門這篇是筆記，適合初學者 OS [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2025/08/27/6391/build-risc-v-on-ubuntu-linux/">Build Risc-V on Ubuntu Linux</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>打算弄個 Risc-V 做個自己的小 Project ，摸了一下大概才知道怎麼入門<br />這篇是筆記，適合初學者</p>



<p>OS: ubuntu 22.04 / 24.04 </p>



<span id="more-6391"></span>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#下載和-compile-source-code">下載和 compile source code</a><ul><li><a href="#install-ubuntu-packages">Install Ubuntu Packages</a></li><li><a href="#install-sbt">Install SBT</a></li><li><a href="#install-open-jdk">Install OpenJDK</a></li><li><a href="#重編-cmake">重編 cmake</a></li><li><a href="#下載-linux-on-litex-vexriscv">下載 linux-on-litex-vexriscv</a></li><li><a href="#編-buildroot-編出-risc-v-的-cross-compiler">編 Buildroot 編出 Risc-V 的 Cross Compiler</a></li><li><a href="#iverilog-版本太舊，重編-iverilog">iverilog 版本太舊，重編 iverilog</a></li><li><a href="#下載-yosys-prjtrellis-nextpnr">下載 yosys/prjtrellis/nextpnr</a></li><li><a href="#下載和編-litex">下載和編 litex</a></li></ul></li><li><a href="#跑-simulation">跑 Simulation</a><ul><li><a href="#跑-simulation-1">跑 simulation</a></li><li><a href="#build-fpga-bitstream-image">Build FPGA Bitstream Image</a></li></ul></li><li><a href="#error-messages">Error Messages</a><ul><li><a href="#ram-1-w-1-rs-generic-v-2-8-timescale-missing-on-this-module-as-other-modules-have-it">Ram_1w_1rs_Generic.v:2:8: Timescale missing on this module as other modules have it</a></li><li><a href="#error-module-eclkbridgecs-referenced-in-module-orange-crab-in-cell-eclkbridgecs-is-not-part-of-the-design">ERROR: Module `\ECLKBRIDGECS&#8217; referenced in module `\orange_crab&#8217; in cell `\ECLKBRIDGECS&#8217; is not part of the design</a></li></ul></li><li><a href="#reference">Reference</a></li></ul></nav></div>



<h2 class="wp-block-heading" id="下載和-compile-source-code">下載和 compile source code </h2>



<p>理論上用 linux-on-litex-vexriscv 照著作就可以了，不過中間還是有很多邊邊角角的小問題要處理 ，如果對系統不夠熟的人會在這邊卡很久。</p>



<h3 class="wp-block-heading" id="install-ubuntu-packages">Install Ubuntu Packages </h3>



<pre class="wp-block-code"><code>sudo apt-get install -y build-essential device-tree-compiler wget git python3-setuptools python3-dev
sudo apt-get install -y libssl-dev libncurses-dev libeigen3-dev
sudo apt-get install -y libevent-dev libjson-c-dev libboost-iostreams-dev
sudo apt-get install -y libreadline-dev tcl-dev libffi-dev bison flex gawk gtkwave

sudo apt-get install -y file bc unzip meson 
sudo apt-get install -y libboost-dev libboost-filesystem-dev libboost-thread-dev libboost-program-options-dev libboost-python-dev libboost-all-dev


# 24.04
sudo apt-get install -y python3-venv </code></pre>



<h3 class="wp-block-heading" id="install-sbt">Install SBT</h3>



<pre class="wp-block-code"><code>sudo apt-get update
sudo apt-get install apt-transport-https curl gnupg -yqq
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&amp;search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
sudo apt-get update
sudo apt-get -y install sbt</code></pre>



<h3 class="wp-block-heading" id="install-open-jdk">Install OpenJDK</h3>



<p>這邊我們用 OpenJDK 17 </p>



<pre class="wp-block-code"><code>sudo apt-get install -y openjdk-17-jdk openjdk-17-jre</code></pre>



<h3 class="wp-block-heading" id="重編-cmake">重編 cmake </h3>



<p>內建的 cmake 看起來版本太低不能用，所以要下載 cmake 手動編譯</p>



<pre class="wp-block-code"><code>wget https://github.com/Kitware/CMake/releases/download/v4.0.3/cmake-4.0.3.tar.gz
tar xvf cmake-4.0.3.tar.gz
cd cmake-4.0.3
./configure
make -j `nproc`
sudo make install</code></pre>



<h3 class="wp-block-heading" id="下載-linux-on-litex-vexriscv">下載 linux-on-litex-vexriscv</h3>



<p>編  buildroot 要指定 linux-on-litex-vexriscv ，所以先下載</p>



<pre class="wp-block-code"><code>git clone https://github.com/litex-hub/linux-on-litex-vexriscv</code></pre>



<h3 class="wp-block-heading" id="編-buildroot-編出-risc-v-的-cross-compiler">編 Buildroot 編出 Risc-V 的 Cross Compiler </h3>



<p>我因為是在其他 CPU 的平台上跑，所以只能自己編 buildroot ，還好 buildroot 已經很成熟了，只是要花時間編出來而已，第一次有錯誤訊息沒關係，確認 output/host/bin/ 下有&#8221;riscv32-&#8221; 開頭的 toolchain 就可以了<br />等到編完 litex 之後再回來重編一次 buildroot 即可</p>



<pre class="wp-block-code"><code>git clone http://github.com/buildroot/buildroot
cd buildroot
make BR2_EXTERNAL=../linux-on-litex-vexriscv/buildroot/ litex_vexriscv_defconfig
make</code></pre>



<h3 class="wp-block-heading" id="iverilog-版本太舊，重編-iverilog">iverilog 版本太舊，重編 iverilog</h3>



<p>iverilog 和 yosys 都要注意不能用到 ubuntu 系統內建的版本，它們都太舊了<br />都要手動重裝新版的</p>



<pre class="wp-block-code"><code>sudo apt-get install -y autoconf gperf make gcc g++ bison flex
git clone https://github.com/steveicarus/iverilog.git
cd iverilog
autoconf
./configure 
sudo make -j `nproc` install </code></pre>



<h3 class="wp-block-heading" id="下載-yosys-prjtrellis-nextpnr">下載 yosys/prjtrellis/nextpnr </h3>



<p>主要是參照這篇 <a href="https://ithelp.ithome.com.tw/articles/10266953" target="_blank" rel="noopener">LiteX/VexRiscv 簡介與使用 (二) 始有晝夜</a> ，但是因為已經是幾年前了，有些東西有點小差異，不過不影響，目錄就用我的工作目錄</p>



<p>這邊要小心一點，最好是先清空相關的程式碼，像是 /nvme/cpu/sysroot/* 和 /usr/local/bin 下的某些檔案，我就吃了虧卡關了很久</p>



<p>如果是 Ubuntu 24.04 ，要先照下面一節的方式先切到 venv 的環境再安裝</p>



<pre class="wp-block-code"><code># 如果還沒做就先將路徑加上去
# 編 buildroot 時不能加入 buildroot 的 path，要編 litex 時再加入即可export PATH=$PATH:/usr/local/bin:/nvme/cpu/buildroot/output/host/bin/:/nvme/cpu/sysroot/bin/:~/.local/bin:

mkdir -p /nvme/cpu/sysroot
cd /nvme/cpu
git clone --recursive https://github.com/YosysHQ/yosys
git clone --recursive https://github.com/YosysHQ/prjtrellis
git clone --recursive https://github.com/YosysHQ/nextpnr
cd yosys
make PREFIX="/nvme/cpu/sysroot" CONFIG=gcc ENABLE_TCL=1 ENABLE_ABC=1 ENABLE_GLOB=1 ENABLE_PLUGINS=1 ENABLE_LIBYOSYS=1 ENABLE_PROTOBUF=1 ENABLE_ZLIB=1 ENABLE_PYOSYS=1 test all install -j `nproc`
cd ..
cd prjtrellis/libtrellis
cmake -DCMAKE_INSTALL_PREFIX=/nvme/cpu/sysroot .
make install -j `nproc`
cd ../../
cd nextpnr
cmake . -DARCH=ecp5 -DTRELLIS_INSTALL_PREFIX=/nvme/cpu/sysroot -B build
cd build
sudo make install -j `nproc`
</code></pre>



<h3 class="wp-block-heading" id="下載和編-litex">下載和編 litex </h3>



<p>ubuntu 22.04 可以用 &#8211;user ，但是 24.04 就強制要用 venv　要先有環境 </p>



<pre class="wp-block-code"><code>cd /nvme/cpu
python3 -m venv litex-venv
source litex-venv/bin/activate</code></pre>



<p>Ubuntu 22.04</p>



<pre class="wp-block-code"><code>cd /nvme/cpu
wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
chmod +x litex_setup.py
./litex_setup.py --init --install --user</code></pre>



<p>Ubuntu 24.04</p>



<pre class="wp-block-code"><code>./litex_setup.py --init --install</code></pre>



<p>Compile Lite-X</p>



<pre class="wp-block-code"><code>cd /nvme/cpu/linux-on-litex-vexriscv
./make.py --board=versa_ecp5 --cpu-count=1 --build</code></pre>



<h2 class="wp-block-heading" id="跑-simulation">跑 Simulation </h2>



<p>順利的話這時環境應該 OK 了，可以跑 simulation 了</p>



<p>先下載 Linux images 到 images</p>



<pre class="wp-block-code"><code>cd /nvme/cpu/linux-on-litex-vexriscv/images
wget https://github.com/litex-hub/linux-on-litex-vexriscv/files/8331338/linux_2022_03_23.zip
unzip linux_2022_03_23.zip</code></pre>



<h3 class="wp-block-heading" id="跑-simulation-1">跑 simulation </h3>



<p>這時就可以跑 simulation 了，不過我跑了 64 Cores 好像更慢，看起來給愈多 code 會跑的更大，像是變 SMP 或是跑到 100Mhz （一核用 1Mhz）<br />可能要花時間設參數，&#8211;jobs 到是可以設大一點</p>



<pre class="wp-block-preformatted">./sim.py<br /><br /># 或是<br />./sim.py <br /><br /># 或是<br />./sim.py  --jobs `nproc` --threads `nproc`<br /></pre>



<p><img loading="lazy" decoding="async" src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXc0cqn58FsJ3udHeeWXAoUNAOw8i-6amS6mlR9KI50IFMgPzvjH9nNR6LJI5xnEjv2Mu2Q2hnnhtVhFYTacZbEV2y7NPgI1tiukpiPoS1W04yON2UWJC0LW8XGwRR2a3Z8xnq0apw?key=08Ji1rDFx5yo_VwHwn3Aoj4y" width="497" height="600"/></p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="929" height="728" src="https://richliu.com/wp-content/uploads/2025/08/image-5.png" alt="" class="wp-image-6393" style="width:528px;height:auto" srcset="https://richliu.com/wp-content/uploads/2025/08/image-5.png 929w, https://richliu.com/wp-content/uploads/2025/08/image-5-600x470.png 600w, https://richliu.com/wp-content/uploads/2025/08/image-5-768x602.png 768w, https://richliu.com/wp-content/uploads/2025/08/image-5-816x639.png 816w" sizes="auto, (max-width: 929px) 100vw, 929px" /></figure>



<p></p>



<h3 class="wp-block-heading" id="build-fpga-bitstream-image">Build FPGA Bitstream Image </h3>



<p>以下就是編  orange_crab FPGA 板子的 command </p>



<pre class="wp-block-code"><code>./make.py --board=orange_crab --cpu-count=1 --build</code></pre>



<p>不過我編出來會 .dts failed <br />可以改編 versa_ecp5 ，這是 ecp5 的公板，目前應該只有 ecp5 可以靠Trellis/Yosys/nextpnr 這三個 Open Source 的軟體編出 FPGA 所需的 bitstream image，orange_crab 也是基於 ecp5 的 FPGA. </p>



<pre class="wp-block-preformatted">./make.py --board=versa_ecp5 --cpu-count=1 --build</pre>



<p>不過我寫這篇的時候還沒買 FPGA ，所以燒到板子上測試要等下一篇了</p>



<h2 class="wp-block-heading" id="error-messages">Error Messages </h2>



<h3 class="wp-block-heading" id="ram-1-w-1-rs-generic-v-2-8-timescale-missing-on-this-module-as-other-modules-have-it">Ram_1w_1rs_Generic.v:2:8: Timescale missing on this module as other modules have it</h3>



<p>原始錯誤訊息</p>



<pre class="wp-block-preformatted">%Error-TIMESCALEMOD: /nvme/cpu/pythondata-cpu-vexriscv-smp/pythondata_cpu_vexriscv_smp/verilog/Ram_1w_1rs_Generic.v:2:8: Timescale missing on this module as other modules have it (IEEE 1800-2017 3.14.2.2)<br />                     /nvme/cpu/pythondata-cpu-vexriscv-smp/pythondata_cpu_vexriscv_smp/verilog/VexRiscvLitexSmpCluster_Cc1_Iw32Is4096Iy1_Dw32Ds4096Dy1_ITs4DTs4_Ldw32_Ood_Hb1.v:8:8: ... Location of module with timescale<br />    8 | module VexRiscvLitexSmpCluster_Cc1_Iw32Is4096Iy1_Dw32Ds4096Dy1_ITs4DTs4_Ldw32_Ood_Hb1 (<br />      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />%Error: Exiting due to 1 error(s)<br />        ... See the manual and https://verilator.org for more assistance.<br />make: *** [/nvme/cpu/litex/litex/build/sim/core/Makefile:44: sim] Error 1<br />make: Leaving directory '/nvme/cpu/linux-on-litex-vexriscv/build/sim/gateware'<br />Testing expectations for wide_thru_priority.v ..Test: code_verilog_tutorial_fsm_full -&gt; ok<br /><br />Test: code_verilog_tutorial_parity -&gt; ok</pre>



<p>修改檔案 /nvme/cpu/pythondata-cpu-vexriscv-smp/pythondata_cpu_vexriscv_smp/verilog/Ram_1w_1rs_Generic.v 加上一行</p>



<pre class="wp-block-code"><code>diff --git a/pythondata_cpu_vexriscv_smp/verilog/Ram_1w_1rs_Generic.v b/pythondata_cpu_vexriscv_smp/verilog/Ram_1w_1rs_Generic.v
index c6e6a96..6a57a2e 100644
--- a/pythondata_cpu_vexriscv_smp/verilog/Ram_1w_1rs_Generic.v
+++ b/pythondata_cpu_vexriscv_smp/verilog/Ram_1w_1rs_Generic.v
@@ -1,3 +1,5 @@
+`timescale 1ns/1ps
+

 module Ram_1w_1rs #(
         parameter integer wordCount = 0,</code></pre>



<h3 class="wp-block-heading" id="error-module-eclkbridgecs-referenced-in-module-orange-crab-in-cell-eclkbridgecs-is-not-part-of-the-design">ERROR: Module `\ECLKBRIDGECS&#8217; referenced in module `\orange_crab&#8217; in cell `\ECLKBRIDGECS&#8217; is not part of the design</h3>



<pre class="wp-block-preformatted">Generating RTLIL representation for module `\VexRiscvLitexSmpCluster_Cc1_Iw32Is4096Iy1_Dw32Ds4096Dy1_ITs4DTs4_Ldw128_Ood_Hb1'.      ERROR: Module `\ECLKBRIDGECS' referenced in module `\orange_crab' in cell `\ECLKBRIDGECS' is not part of the design.   </pre>



<p>yosys 太舊，我是裝到系統的 yosys ，移除掉系統的 yosys 再自己編 yosys 就可以了</p>



<p></p>



<h2 class="wp-block-heading" id="reference">Reference</h2>



<p><a href="https://ithelp.ithome.com.tw/articles/10266953" target="_blank" rel="noopener">LiteX/VexRiscv 簡介與使用 (二) 始有晝夜</a> <br /><a href="https://github.com/enjoy-digital/litex" target="_blank" rel="noopener">LiteX</a><br /><a href="https://github.com/litex-hub/linux-on-litex-vexriscv" target="_blank" rel="noopener">linux-on-litex-vexriscv</a><br /><a href="https://github.com/litex-hub/linux-on-litex-vexriscv/issues/164" target="_blank" rel="noopener">Prebuilt Bitstreams and Linux/OpenSBI images</a> (抓 Linux Kernel 用)<br /><a href="https://orangecrab-fpga.github.io/orangecrab-hardware/docs/getting-started/" target="_blank" rel="noopener">Orange Crab 主網站</a><br /><a href="https://github.com/YosysHQ/oss-cad-suite-build" target="_blank" rel="noopener">OSS CAD Suite</a><br /><a href="https://gitlab.com/buildroot.org/buildroot/" target="_blank" rel="noopener">Buildroot</a></p>



<p></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2025/08/27/6391/build-risc-v-on-ubuntu-linux/">Build Risc-V on Ubuntu Linux</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2025/08/27/6391/build-risc-v-on-ubuntu-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>GPU Passthrough on ARM64 with Libvirt/Virt-manager</title>
		<link>https://richliu.com/2025/02/12/6182/gpu-passthrough-on-arm64-with-libvirt-virt-manager/</link>
					<comments>https://richliu.com/2025/02/12/6182/gpu-passthrough-on-arm64-with-libvirt-virt-manager/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 12 Feb 2025 09:18:24 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[ALTRAD8UD]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[DeepSeek]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nvidia]]></category>
		<category><![CDATA[ollama]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=6182</guid>

					<description><![CDATA[<p>In this article, I’ll walk you through the steps to set [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2025/02/12/6182/gpu-passthrough-on-arm64-with-libvirt-virt-manager/">GPU Passthrough on ARM64 with Libvirt/Virt-manager</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this article, I’ll walk you through the steps to set up GPU passthrough on an ARM64 system using Libvirt and Virt-manager. While using the ChatGPT to search answer, the steps may seem straightforward, but missing a critical detail can cause the process to fail.</p>



<p><strong>System Specifications</strong></p>



<p><strong>Nvidia Driver</strong>: NVIDIA-Linux-aarch64-570.86.16.run<br /><strong>Host</strong>: Ampere Altra + ALTRAD8UD<br /><strong>Host OS</strong>: Ubuntu 22.04 with HWE kernel (6.8)<br /><strong>Guest OS</strong>: Ubuntu 22.04 (ubuntu-22.04-live-server-arm64.iso)<br /><strong>GPU</strong>: Nvidia RTX 4080 16GB</p>



<p><strong>Assumptions</strong></p>



<ol start="1" class="wp-block-list">
<li>You are familiar with Ubuntu and its basic commands.</li>



<li>You have experience using Virt-manager.</li>



<li>All commands are executed as the root user.</li>
</ol>



<p>If anything is unclear, you can refer to external resources for additional guidance.</p>



<span id="more-6182"></span>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#host-configuration">Host Configuration </a><ul><li><a href="#enable-iommu">Enable IOMMU</a></li><li><a href="#host-upgrade-to-hwe-kernel">Upgrade Host to HWE Kernel</a></li><li><a href="#configure-the-vfio-on-host">Configure VFIO on Host</a></li><li><a href="#disable-nvidia-driver-on-the-host">Disable Nvidia Driver on HOST</a></li></ul></li><li><a href="#configure-vm">Configure VM</a><ul><li><a href="#i">Install Virt-manager</a></li><li><a href="#create-vm-image">Create VM image</a></li><li><a href="#create-vm">Add Nvidia device to VM</a></li><li><a href="#disable-security-boot">Disable secure Boot in UEFI</a></li><li><a href="#gpu-passthrough-test">GPU Passthrough Test</a></li></ul></li></ul></nav></div>



<h2 class="wp-block-heading" id="host-configuration">Host Configuration </h2>



<h3 class="wp-block-heading" id="enable-iommu">Enable IOMMU</h3>



<p>To enable IOMMU, you need to enable the SR-IOV option in the BIOS and verify whether the Linux kernel has IOMMU enabled by default.</p>



<p>You can check if IOMMU is enabled by running:</p>



<pre class="wp-block-preformatted">$ dmesg | grep -i iommu</pre>



<p>Example output:</p>



<pre class="wp-block-preformatted">[    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-6.8.0-52-generic root=UUID=6b78fa89-a575-432d-a445-1497c3467214 ro iommu=on<br />[    0.000000] Unknown kernel command line parameters "BOOT_IMAGE=/boot/vmlinuz-6.8.0-52-generic iommu=on", will be passed to user space.<br />[   11.561684] <strong>iommu: Default domain type: Translated</strong><br />[   11.566470] <strong>iommu: DMA domain TLB invalidation policy: strict mode</strong></pre>



<p>If IOMMU is not enabled, add <code>iommu=on</code> to the Linux kernel boot parameters:</p>



<pre class="wp-block-preformatted">$ vim /etc/default/grub </pre>



<p>Modify the line:</p>



<pre class="wp-block-preformatted">GRUB_CMDLINE_LINUX_DEFAULT="iommu=on"</pre>



<p>Then update GRUB and reboot:</p>



<pre class="wp-block-preformatted">$ update-grub2  <br />$ reboot  </pre>



<p>Additionally, enable SR-IOV in the BIOS. The exact location of this setting varies depending on the BIOS, but it is typically found under the PCIe subsystem or related options.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1280" height="770" src="https://richliu.com/wp-content/uploads/2025/02/image-4.png" alt="" class="wp-image-6183" srcset="https://richliu.com/wp-content/uploads/2025/02/image-4.png 1280w, https://richliu.com/wp-content/uploads/2025/02/image-4-600x361.png 600w, https://richliu.com/wp-content/uploads/2025/02/image-4-768x462.png 768w, https://richliu.com/wp-content/uploads/2025/02/image-4-816x491.png 816w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></figure>



<h3 class="wp-block-heading" id="host-upgrade-to-hwe-kernel"><strong>Upgrade Host to HWE Kernel</strong></h3>



<p>I recommend using the Hardware Enablement (HWE) kernel on the host. While I’m unsure if the regular kernel works, the HWE kernel has been reliable in my experience. Install it with:</p>



<pre class="wp-block-preformatted">sudo apt install linux-generic-hwe-22.04</pre>



<h3 class="wp-block-heading" id="configure-the-vfio-on-host">Configure VFIO on Host</h3>



<p>The VM relies on the VFIO driver for GPU passthrough. To configure VFIO, you need to pass the PCIe device information to the VFIO driver.</p>



<p>First, identify the GPU’s PCIe device IDs:</p>



<pre class="wp-block-preformatted">$ lspci -nn</pre>



<p>Example output:</p>



<pre class="wp-block-preformatted"><br /><br />0005:01:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [<strong>10de:2704</strong>] (rev a1)<br />0005:01:00.1 Audio device [0403]: NVIDIA Corporation Device [<strong>10de:22bb</strong>] (rev a1)</pre>



<p>Here, <strong><code>10de:2704</code> </strong>is the GPU’s PCIe device ID, and <code><strong>10de:22bb</strong></code> is the audio device ID. At a minimum, you need to pass through the GPU device.</p>



<p>Next, edit the VFIO configuration file to include these IDs:</p>



<pre class="wp-block-preformatted">$ vim /etc/modprobe.d/vfio.conf</pre>



<p>Add the following line:</p>



<pre class="wp-block-preformatted">options vfio-pci ids=10de:2704,10de:22bb</pre>



<h3 class="wp-block-heading" id="disable-nvidia-driver-on-the-host">Disable Nvidia Driver on HOST</h3>



<p>To prevent the host from loading the Nvidia driver, add the Nvidia modules to the kernel’s blocklist:</p>



<pre class="wp-block-preformatted">$ vim /etc/modprobe.d/blacklist.conf</pre>



<p>Add the following lines:</p>



<pre class="wp-block-preformatted">blacklist nvidia<br />blacklist nvidia_drm<br />blacklist nvidia_modeset</pre>



<p>Update the initramfs and reboot:</p>



<pre class="wp-block-preformatted">$ update-initramfs -u<br />$ reboot</pre>



<h2 class="wp-block-heading" id="configure-vm">Configure VM</h2>



<h3 class="wp-block-heading" id="i">Install Virt-manager</h3>



<p>In this article, we used virt-manager as VM manager, first step is install virt-manager, suppose Ubuntu will install all relative packages. </p>



<pre class="wp-block-preformatted">$ apt install virt-manager </pre>



<p>If you’re using SSH with X11 forwarding (e.g.,&nbsp;<code>ssh -X host</code>) or MobaXTerm on Windows, Virt-manager will display the remote X window. If neither method works, consider installing a KDE desktop on the host and accessing it via the BMC remote console.</p>



<p>(Optional) Install KDE Plasma Desktop:</p>



<pre class="wp-block-preformatted">(option)<br />$ apt install kde-plasma-desktop</pre>



<h3 class="wp-block-heading" id="create-vm-image">Create VM image</h3>



<p>Virt-manager creates fixed-size VM images by default. If you prefer dynamic allocation, create the image manually:</p>



<pre class="wp-block-preformatted">$ qemu-img create -f qcow2 ubuntu2204.qcow2 200G</pre>



<h3 class="wp-block-heading" id="create-vm">Add Nvidia device to VM</h3>



<p>If the host is configured correctly, Virt-manager will list all PCIe devices, including the Nvidia GPU. Add the GPU and its audio device (e.g., <code><strong>0005:01:00.0</strong></code> and <code><strong>0005:01:00.1</strong></code>) to the VM’s hardware list.</p>



<p>After adding the devices, proceed with the Ubuntu 22.04 installation.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1023" height="632" src="https://richliu.com/wp-content/uploads/2025/02/image-5.png" alt="" class="wp-image-6184" srcset="https://richliu.com/wp-content/uploads/2025/02/image-5.png 1023w, https://richliu.com/wp-content/uploads/2025/02/image-5-600x371.png 600w, https://richliu.com/wp-content/uploads/2025/02/image-5-768x474.png 768w, https://richliu.com/wp-content/uploads/2025/02/image-5-816x504.png 816w" sizes="auto, (max-width: 1023px) 100vw, 1023px" /></figure>



<p>After add hardware </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1046" height="646" src="https://richliu.com/wp-content/uploads/2025/02/image-6.png" alt="" class="wp-image-6185" srcset="https://richliu.com/wp-content/uploads/2025/02/image-6.png 1046w, https://richliu.com/wp-content/uploads/2025/02/image-6-600x371.png 600w, https://richliu.com/wp-content/uploads/2025/02/image-6-768x474.png 768w, https://richliu.com/wp-content/uploads/2025/02/image-6-816x504.png 816w" sizes="auto, (max-width: 1046px) 100vw, 1046px" /></figure>



<p>Now, it can run begin install to install ubuntu 22.04</p>



<h3 class="wp-block-heading" id="disable-security-boot">Disable secure Boot in UEFI</h3>



<p>By default, Virt-manager enables Secure Boot. However, Nvidia drivers may not work with Secure Boot enabled. Even though the Nvidia installer includes a driver signing feature, the driver may still fail to load. To avoid issues, disable Secure Boot in the VM’s UEFI settings.</p>



<p>During the VM’s boot process, press the <strong><code>DEL</code> </strong>key to enter UEFI settings and uncheck the Secure Boot option.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="973" height="632" src="https://richliu.com/wp-content/uploads/2025/02/image-7.png" alt="" class="wp-image-6186" srcset="https://richliu.com/wp-content/uploads/2025/02/image-7.png 973w, https://richliu.com/wp-content/uploads/2025/02/image-7-600x390.png 600w, https://richliu.com/wp-content/uploads/2025/02/image-7-768x499.png 768w, https://richliu.com/wp-content/uploads/2025/02/image-7-816x530.png 816w" sizes="auto, (max-width: 973px) 100vw, 973px" /></figure>



<p>Before installing the Nvidia driver, ensure the necessary development packages are installed:</p>



<pre class="wp-block-preformatted">$ apt install build-essential</pre>



<p>Then, install the Nvidia driver and reboot the VM.</p>



<h3 class="wp-block-heading" id="gpu-passthrough-test">GPU Passthrough Test</h3>



<p>If everything is set up correctly, running <code><strong>nvidia-smi</strong></code> should display the GPU’s status.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1280" height="515" src="https://richliu.com/wp-content/uploads/2025/02/image-8.png" alt="" class="wp-image-6188" srcset="https://richliu.com/wp-content/uploads/2025/02/image-8.png 1280w, https://richliu.com/wp-content/uploads/2025/02/image-8-600x241.png 600w, https://richliu.com/wp-content/uploads/2025/02/image-8-768x309.png 768w, https://richliu.com/wp-content/uploads/2025/02/image-8-816x328.png 816w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></figure>



<p>For testing, you can use&nbsp;<strong>Ollama</strong>&nbsp;with the&nbsp;<strong>Deepseek-R1</strong>&nbsp;model. Install Ollama with:</p>



<pre class="wp-block-preformatted">curl -fsSL https://ollama.com/install.sh | sh</pre>



<p>Pull the Deepseek-R1 model. Since the GPU has 16GB of memory, the 14B model is a good choice (it requires ~10GB):</p>



<pre class="wp-block-preformatted">ollama run deepseek-r1:14b</pre>



<p>Ask a question like, “Why is the sky blue?” This will trigger the model’s Chain-of-Thought (CoT) reasoning.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1280" height="772" src="https://richliu.com/wp-content/uploads/2025/02/image-9.png" alt="" class="wp-image-6189" srcset="https://richliu.com/wp-content/uploads/2025/02/image-9.png 1280w, https://richliu.com/wp-content/uploads/2025/02/image-9-600x362.png 600w, https://richliu.com/wp-content/uploads/2025/02/image-9-768x463.png 768w, https://richliu.com/wp-content/uploads/2025/02/image-9-816x492.png 816w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></figure>



<p>Monitor the GPU’s status using <code>nvidia-smi</code> to ensure it’s functioning correctly.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1280" height="577" src="https://richliu.com/wp-content/uploads/2025/02/image-10.png" alt="" class="wp-image-6190" srcset="https://richliu.com/wp-content/uploads/2025/02/image-10.png 1280w, https://richliu.com/wp-content/uploads/2025/02/image-10-600x270.png 600w, https://richliu.com/wp-content/uploads/2025/02/image-10-768x346.png 768w, https://richliu.com/wp-content/uploads/2025/02/image-10-816x368.png 816w" sizes="auto, (max-width: 1280px) 100vw, 1280px" /></figure>



<p></p>



<p></p>



<p></p>



<p></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2025/02/12/6182/gpu-passthrough-on-arm64-with-libvirt-virt-manager/">GPU Passthrough on ARM64 with Libvirt/Virt-manager</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2025/02/12/6182/gpu-passthrough-on-arm64-with-libvirt-virt-manager/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>TTPoE Tesla Transport Protocol (TTP) Over Ethernet 簡評</title>
		<link>https://richliu.com/2024/11/21/6081/ttpoe-tesla-transport-protocol-ttp-over-ethernet-%e7%b0%a1%e8%a9%95/</link>
					<comments>https://richliu.com/2024/11/21/6081/ttpoe-tesla-transport-protocol-ttp-over-ethernet-%e7%b0%a1%e8%a9%95/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 21 Nov 2024 07:09:43 +0000</pubDate>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[IC Design]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[ethernet]]></category>
		<category><![CDATA[tcp]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=6081</guid>

					<description><![CDATA[<p>早上瞄到這篇文章討論的 Tesla’s TTPoE at Hot Chips 2024: Replacing  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/11/21/6081/ttpoe-tesla-transport-protocol-ttp-over-ethernet-%e7%b0%a1%e8%a9%95/">TTPoE Tesla Transport Protocol (TTP) Over Ethernet 簡評</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>早上瞄到這篇文章討論的 <a href="https://chipsandcheese.com/p/teslas-ttpoe-at-hot-chips-2024-replacing-tcp-for-low-latency-applications" target="_blank" rel="noopener">Tesla’s TTPoE at Hot Chips 2024: Replacing TCP for Low Latency Applications</a> ，去年 Telsa 建了 Dojo SuperComputing ，今年就弄了一個新的 Protocol </p>



<p>TCP 已經是一個非常陳舊的 Protocol ，其中很多特性已經不再適合目前的網路環境，像QUIC架在UDP上層，增加安全性和速度。SCTP主打多連結，可靠性和安全，SCTP在電信環境用的比較多。基於 UDP 大量傳送資料的有 UDT (UDP-Based Data Transfer protocol) 等等</p>



<span id="more-6081"></span>



<p>TTPoE 看起來應該是 Telsa 降本增效（名詞好用就拿來用）的實作，因為如果是使用RDMA之類的解決方案應該都有更快的 NIC Card 可以用(目前最快是 800Gbps 2 Ports QSPF-DD), 但是 TTPoE 是用 100G NIC 卡但是重新實做了整個 NIC Card ，雖然這樣講，未來仍然有升級的空間</p>



<p>我認為 TTPoE 的主要設計目地就是 Low Latency and Low Cost，因為 TTPoE 看起來是要做 HBM2HBM 的資料同步，Low latency 應該還是主要考量，因為他們要實作在 Hardware 上</p>



<p>而 data center(DC) 下是 data loseless 的環境，相對的網路環境比較好，如果有開啟 ethernet congession control ，理論下會丟掉的封包比較少，頻寬大。基於這個特性，TTPoE 就是做刪去法，將 TCP 協定中多餘的 Latency 去掉，仍然使用 IP 協定，保有和現有網路的相容性，以下這張圖就可以清楚的知道，TTP 是取代 TCP 的位置，上層仍然能夠跟 RDMA 接，其他 socket 或 APP 應該也可以，不過主要應該還是給RDMA這類高速記憶體協定用</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1456" height="817" src="https://richliu.com/wp-content/uploads/2024/11/image-6.png" alt="" class="wp-image-6082" srcset="https://richliu.com/wp-content/uploads/2024/11/image-6.png 1456w, https://richliu.com/wp-content/uploads/2024/11/image-6-600x337.png 600w, https://richliu.com/wp-content/uploads/2024/11/image-6-768x431.png 768w, https://richliu.com/wp-content/uploads/2024/11/image-6-816x458.png 816w" sizes="auto, (max-width: 1456px) 100vw, 1456px" /></figure>



<p>（註： 本圖來自 <a href="https://chipsandcheese.com/p/teslas-ttpoe-at-hot-chips-2024-replacing-tcp-for-low-latency-applications" target="_blank" rel="noopener">Tesla’s TTPoE at Hot Chips 2024: Replacing TCP for Low Latency Applications</a> ，原圖應該是 Hot Chips 2024 Telsa 的 slide，以下不再重覆說明 ）</p>



<p>為了讓 Hardware 更容易設計，所以簡化了 TTP 的 Protocol State machine ，這是是目標也是結果，因為簡化 Protocol 也會簡化 state machine </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1456" height="813" src="https://richliu.com/wp-content/uploads/2024/11/image-7.png" alt="" class="wp-image-6083" srcset="https://richliu.com/wp-content/uploads/2024/11/image-7.png 1456w, https://richliu.com/wp-content/uploads/2024/11/image-7-600x335.png 600w, https://richliu.com/wp-content/uploads/2024/11/image-7-768x429.png 768w, https://richliu.com/wp-content/uploads/2024/11/image-7-816x456.png 816w" sizes="auto, (max-width: 1456px) 100vw, 1456px" /></figure>



<p>將 TCP 的 Three way handshake 改成 Two way handshake，其實 internet 防火牆需要這個機制判斷是不是真實連線，但是 DC 內部不需要，拿掉合理，也可以減少很多 Latency <br />有些人要加速會改 TCP ACK 到下一筆資料送出的時間，不過這會造成某些硬體加速器的問題</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="839" height="530" src="https://richliu.com/wp-content/uploads/2024/11/image-8.png" alt="" class="wp-image-6084" srcset="https://richliu.com/wp-content/uploads/2024/11/image-8.png 839w, https://richliu.com/wp-content/uploads/2024/11/image-8-600x379.png 600w, https://richliu.com/wp-content/uploads/2024/11/image-8-768x485.png 768w, https://richliu.com/wp-content/uploads/2024/11/image-8-816x515.png 816w" sizes="auto, (max-width: 839px) 100vw, 839px" /></figure>



<p>這邊應該是要將如果有個 Packet 是 NACK ，後面的 packet 都重送，這樣雖然會傳比較多資料，但是 DC package loseless 環境，這樣的機率小，可以接受這樣的設計<br />TTP 也拿掉 tcp congestion control 這個功能，如果只在 DC 用，這功能完全不需要，因為路上幾乎都是大頻寬，如果頻寬不夠就要從別的地方觀測調整，不是 Protocol 的問題，packet 的 sliding window 就設一個固定值，符合系統大部份時間都可以以最高速運作即可</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1456" height="815" src="https://richliu.com/wp-content/uploads/2024/11/image-9.png" alt="" class="wp-image-6085" srcset="https://richliu.com/wp-content/uploads/2024/11/image-9.png 1456w, https://richliu.com/wp-content/uploads/2024/11/image-9-600x336.png 600w, https://richliu.com/wp-content/uploads/2024/11/image-9-768x430.png 768w, https://richliu.com/wp-content/uploads/2024/11/image-9-816x457.png 816w" sizes="auto, (max-width: 1456px) 100vw, 1456px" /></figure>



<p>TTP Protocol 有些有趣的地方，Extension header 二個，第一個是指定 type 用的，第二個可能是未來用，這應該是固定大小，然後 Data payload 是 64 bytes 的倍數 </p>



<p>有趣的是用 SRAM size 做 speculative transmission，這個設計我喜歡，好的演算法就是不需要演算法，讓系統自己去調整(self-adaptive)，不過我懷疑這個就是 ethernet 的 tx buffer 講成高大上而已</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1456" height="812" src="https://richliu.com/wp-content/uploads/2024/11/image-10.png" alt="" class="wp-image-6086" srcset="https://richliu.com/wp-content/uploads/2024/11/image-10.png 1456w, https://richliu.com/wp-content/uploads/2024/11/image-10-600x335.png 600w, https://richliu.com/wp-content/uploads/2024/11/image-10-768x428.png 768w, https://richliu.com/wp-content/uploads/2024/11/image-10-816x455.png 816w" sizes="auto, (max-width: 1456px) 100vw, 1456px" /></figure>



<p>這意思就是前面還放傳統的 ethernet 架構，TTP mac controller 控制　ethernet 介面傳送資料，灰色部份都是現成的</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1456" height="808" src="https://richliu.com/wp-content/uploads/2024/11/image-11.png" alt="" class="wp-image-6087" srcset="https://richliu.com/wp-content/uploads/2024/11/image-11.png 1456w, https://richliu.com/wp-content/uploads/2024/11/image-11-600x333.png 600w, https://richliu.com/wp-content/uploads/2024/11/image-11-768x426.png 768w, https://richliu.com/wp-content/uploads/2024/11/image-11-816x453.png 816w" sizes="auto, (max-width: 1456px) 100vw, 1456px" /></figure>



<p>TTP hardware micro-architecture 設計</p>



<p>下方的 Next packet linked list SRAM，雖然講是 linked list SRAM，不過為什麼不做 array 當 ring buffer 呢？還是指的是同一件事，做過 NIC 卡就知道這種地方設計就固定是那樣，尤其是做成 hardware 又要結構更簡單，所以我才懷疑前面講的 SRAM 做 flow control 就是講這邊，如果 ring buffer 滿了就表示外面滿了</p>



<p>一般這種高階通常都有數個 TX/RX buffer ，不知道是不是因為專供 RDMA 用所以這邊就只畫上一個 TX/RX buffer ？而且不確定是不是因為一個 Buffer 頻寬就滿了（或是 FPGA 只能規劃 1MB，都有可能）</p>



<p>80 microseconds 在高速網路世界已經算很久了，算 OK <br />slide 最後一行我覺得才是真正的目地，如果是在 AI server 上要跑這個，那不用更高階的卡跑 RDMA 就很合理了</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1456" height="808" src="https://richliu.com/wp-content/uploads/2024/11/image-12.png" alt="" class="wp-image-6088" srcset="https://richliu.com/wp-content/uploads/2024/11/image-12.png 1456w, https://richliu.com/wp-content/uploads/2024/11/image-12-600x333.png 600w, https://richliu.com/wp-content/uploads/2024/11/image-12-768x426.png 768w, https://richliu.com/wp-content/uploads/2024/11/image-12-816x453.png 816w" sizes="auto, (max-width: 1456px) 100vw, 1456px" /></figure>



<p>&#8220;Mojo&#8221; 100GB dumb-NIC （話說我以前做過的某 project 我叫 SmartXXX 呢）<br />中間這麼大一顆可能是 SoC 也可能是 FPGA ，我覺得 FPGA 的機率大一點，畢竟要改 code 這階段還是用 FPGA 穩定</p>



<p>CPU 的是用 Gen3 x16 和 8GB DDR4，Gen3 比較有趣，表示這真的是降成本達到目地</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1456" height="814" src="https://richliu.com/wp-content/uploads/2024/11/image-13.png" alt="" class="wp-image-6089" srcset="https://richliu.com/wp-content/uploads/2024/11/image-13.png 1456w, https://richliu.com/wp-content/uploads/2024/11/image-13-600x335.png 600w, https://richliu.com/wp-content/uploads/2024/11/image-13-768x429.png 768w, https://richliu.com/wp-content/uploads/2024/11/image-13-816x456.png 816w" sizes="auto, (max-width: 1456px) 100vw, 1456px" /></figure>



<p>Latencies ，竟然 TTPoE 比 Nvlink 還快，Nvlink 已經算是對傳了，要過 ethernet 還比較快讓我難以想像</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1456" height="810" src="https://richliu.com/wp-content/uploads/2024/11/image-14.png" alt="" class="wp-image-6090" srcset="https://richliu.com/wp-content/uploads/2024/11/image-14.png 1456w, https://richliu.com/wp-content/uploads/2024/11/image-14-600x334.png 600w, https://richliu.com/wp-content/uploads/2024/11/image-14-768x427.png 768w, https://richliu.com/wp-content/uploads/2024/11/image-14-816x454.png 816w" sizes="auto, (max-width: 1456px) 100vw, 1456px" /></figure>



<h2 class="wp-block-heading">總結</h2>



<p>我覺得技術細節透露有限，但是這個方向的確可以大幅減少 latency ，在網路的世界內，減少 latency 就是增加速率和效率，在頻寬固定的狀況之下</p>



<p>雖然相容性不佳，只是給 RDMA 用，但是我覺得仍不失為 intranet 上有趣的應用，而且的確很適合 DC  使用</p>



<p>ref. <a href="https://github.com/teslamotors/ttpoe/tree/master" target="_blank" rel="noopener">Github ttpoe</a> Linux kernel 的 software 實作和規格, 要先有 software 才能搞 hardware 啊.</p>



<p></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/11/21/6081/ttpoe-tesla-transport-protocol-ttp-over-ethernet-%e7%b0%a1%e8%a9%95/">TTPoE Tesla Transport Protocol (TTP) Over Ethernet 簡評</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/11/21/6081/ttpoe-tesla-transport-protocol-ttp-over-ethernet-%e7%b0%a1%e8%a9%95/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Gentoo ARM64 Altra Compile chromium Issue</title>
		<link>https://richliu.com/2024/10/10/6052/gentoo-arm64-altra-compile-chromium-issue/</link>
					<comments>https://richliu.com/2024/10/10/6052/gentoo-arm64-altra-compile-chromium-issue/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 09 Oct 2024 17:22:12 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=6052</guid>

					<description><![CDATA[<p>When compile the chromium on my Altra platform, it meet [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/10/10/6052/gentoo-arm64-altra-compile-chromium-issue/">Gentoo ARM64 Altra Compile chromium Issue</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When compile the chromium on my Altra platform, it meet compile problem like this</p>



<span id="more-6052"></span>



<pre class="wp-block-preformatted">no-dangling-assignment-gsl -std=c++20 -Wno-trigraphs -gsimple-template-names -fno-exceptio00:01:51 [472/19443]
nc++ -isystem../../third_party/libc++/src/include -isystem../../third_party/libc++abi/src/include -fvisibility
-inlines-hidden -O2 -pipe -march=armv8.2-a -Wno-unknown-warning-option -c ../../third_party/libyuv/source/comp
are_neon64.cc -o obj/third_party/libyuv/libyuv_neon/compare_neon64.o
../../third_party/libyuv/source/compare_neon64.cc:175:8: error: instruction requires: dotprod
  175 |       "udot        v4.4s, v0.16b, v6.16b         \n"
      |        ^
&lt;inline asm>:14:1: note: instantiated into assembly here
   14 | udot        v4.4s, v0.16b, v6.16b
      | ^
../../third_party/libyuv/source/compare_neon64.cc:176:8: error: instruction requires: dotprod
  176 |       "udot        v5.4s, v1.16b, v6.16b         \n"
      |        ^
&lt;inline asm>:15:1: note: instantiated into assembly here
   15 | udot        v5.4s, v1.16b, v6.16b
      | ^
../../third_party/libyuv/source/compare_neon64.cc:204:8: error: instruction requires: dotprod
  204 |       "udot        v4.4s, v0.16b, v0.16b         \n"
      |        ^
&lt;inline asm>:10:1: note: instantiated into assembly here
   10 | udot        v4.4s, v0.16b, v0.16b
      | ^
../../third_party/libyuv/source/compare_neon64.cc:205:8: error: instruction requires: dotprod
  205 |       "udot        v5.4s, v1.16b, v1.16b         \n"
      |        ^
&lt;inline asm>:11:1: note: instantiated into assembly here
   11 | udot        v5.4s, v1.16b, v1.16b
      | ^
4 errors generated.
[10940/63891] aarch64-unknown-linux-gnu-clang++-18 -MD -MF obj/third_party/libyuv/libyuv_neon/rotate_neon.o.d</pre>



<p>Seems because some -march/-mcpu/-mtune drop &#8216;dotprod&#8217; parameters, it needs to add the extension manuall. &#8216;+dotprod&#8217;.</p>



<p>Edit the file /etc/portage/make.conf, and change the COMMON_FLAGS to </p>



<pre class="wp-block-preformatted">COMMON_FLAGS="-mcpu=neoverse-n1+crc+crypto+ssbs+dotprod -O2 -pipe"</pre>



<p>It can use the following command to get current CPU flag</p>



<pre class="wp-block-preformatted">gcc -v -E -x c /dev/null -o /dev/null -march=native -mcpu=native 2>&amp;1 | grep /cc1</pre>



<p>Thanks Gentoo user zukunf to provide those information. </p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/10/10/6052/gentoo-arm64-altra-compile-chromium-issue/">Gentoo ARM64 Altra Compile chromium Issue</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/10/10/6052/gentoo-arm64-altra-compile-chromium-issue/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>FreeBSD Build Kernel</title>
		<link>https://richliu.com/2024/09/11/6040/freebsd-build-kernel/</link>
					<comments>https://richliu.com/2024/09/11/6040/freebsd-build-kernel/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Tue, 10 Sep 2024 16:13:42 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[kernel]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=6040</guid>

					<description><![CDATA[<p>Google Bing 查了半天不如問 Claude ，雖然現在LLM很方便，不過還是會有小問題，記錄一下過程 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/09/11/6040/freebsd-build-kernel/">FreeBSD Build Kernel</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Google Bing 查了半天不如問 Claude ，雖然現在LLM很方便，不過還是會有小問題，記錄一下過程</p>



<span id="more-6040"></span>



<p>我的環境是 ARM64，所以以 ARM64 為主，編的版本是 15.0-Current</p>



<pre class="wp-block-preformatted"># Install git first
# pkg install git
# Install Source code from Git 
git clone https://git.freebsd.org/src.git /usr/src

cd /usr/src/sys/arm64/conf
cp GENERIC MYKERNEL
vim MYKERNEL</pre>



<p>以下應該可以整理成一個 script</p>



<pre class="wp-block-preformatted">cd /usr/src

# Remove old file
mkdir /usr/obj/tmp
chflags -R noschg /usr/obj/*
rm -rf /usr/obj/*

# Build world and kernel 
# Cannot use 128 cores to build that because it might cause build problem. 
# reduce it to 16 might be better 
make -j 16 buildworld
# Clean kernel if necesssary 
# make -j 16 cleankernel KERNCONF=MYKERNEL
make -j 16 buildkernel KERNCONF=MYKERNEL

# Install world and kernel to a temperory directory
mkdir /usr/obj/tmp
make installworld DESTDIR=/usr/obj/tmp
make installkernel KERNCONF=MYKERNEL DESTDIR=/usr/obj/tmp

# copy release document to the directory
make distribution DESTDIR=/usr/obj/tmp

# build release
cd release
make -j 16 release KERNCONF=MYKERNEL NODOC=yes NOPORTS=yes NOSRC=yes</pre>



<p>Release files (iso, image 等等) 會在<br />/ussr/obj/usr/src/arm64.aarch64/release 下</p>



<h3 class="wp-block-heading">Clean kernel </h3>



<pre class="wp-block-preformatted">make cleankernel KERNCONF=MYKERNEL</pre>



<p>修改 EFI_STAGING_SIZE，修改 /usr/src/stand/efi/loader/copy.c , 找到</p>



<pre class="wp-block-preformatted">#define DEFAULT_EFI_STAGING_SIZE</pre>



<p>統統改成要的值，ex: 100 ，這樣就好，暴力解決</p>



<h3 class="wp-block-heading">Enable exec=&#8221;copy_staging auto&#8221; in /boot/loader.conf</h3>



<p>這個功能因為要在編 world 放到 loader.conf 內，這樣 iso 和 memstick 檔案內才，所以我用了一個 hacker 的手法，編輯 release/Makefile ，約 Line 188，加上</p>



<pre class="wp-block-preformatted">echo exec=\"copy_staging disable\" >> ${.TARGET}/boot/loader.conf</pre>



<h3 class="wp-block-heading">Enable Early Printf In Kernel </h3>



<p>編輯  MYKERNEL ，加上[<a href="https://github.com/freebsd/freebsd-src/blob/3c95262007ef934c9e98b87460a48889bf42c1b9/sys/kern/kern_cons.c#L76" target="_blank" rel="noopener">ref</a>]</p>



<pre class="wp-block-preformatted">options EARLY_PRINTF=pl011</pre>



<p></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/09/11/6040/freebsd-build-kernel/">FreeBSD Build Kernel</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/09/11/6040/freebsd-build-kernel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Dynatron W3 for Ampere AltraMax</title>
		<link>https://richliu.com/2024/08/02/6012/dynatron-w3-for-ampere-altramax/</link>
					<comments>https://richliu.com/2024/08/02/6012/dynatron-w3-for-ampere-altramax/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Thu, 01 Aug 2024 16:27:28 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[ALTRAD8UD]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[Ampere Computing]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=6012</guid>

					<description><![CDATA[<p>The Dynatron W3 fan package offers an alternative cooling solution, including a tower heatsink and 120mm fan. It's easy to install. Preliminary tests on an AltraMax 128-30 CPU show the fan maintains 64°C at 1400 RPM, consuming around 178W. While suitable for general use.</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/08/02/6012/dynatron-w3-for-ampere-altramax/">Dynatron W3 for Ampere AltraMax</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Ampere AltraMax is a powerful server CPU with numerous cores. However, it lacks solutions for end users, with the ASRock Rack motherboard being the only available option. The original package includes a heatsink but no CPU fan, necessitating alternative heat dissipation methods. Currently, there are some tower fans available, and I have acquired a <a href="https://ja.dynatron.co/product-page/w3" target="_blank" rel="noopener">Dynatron W3</a> fan (from <a href="https://www.newegg.com/dynatron-w3/p/N82E16835114163" target="_blank" rel="noopener">newegg</a>) for preliminary testing.</p>



<span id="more-6012"></span>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222502-scaled.jpg" alt="" class="wp-image-6013" srcset="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222502-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222502-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222502-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222502-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222502-2048x1536.jpg 2048w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222502-816x612.jpg 816w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p>The Dynatron W3 package comes in a standard case.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222514-scaled.jpg" alt="" class="wp-image-6014" srcset="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222514-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222514-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222514-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222514-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222514-2048x1536.jpg 2048w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222514-816x612.jpg 816w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p>includes a tower heatsink, one 120mm 4-pin fan, and thermal paste.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1920" height="2560" src="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222526-scaled.jpg" alt="" class="wp-image-6015" srcset="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222526-scaled.jpg 1920w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222526-450x600.jpg 450w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222526-768x1024.jpg 768w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222526-1152x1536.jpg 1152w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222526-1536x2048.jpg 1536w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222526-816x1088.jpg 816w" sizes="auto, (max-width: 1920px) 100vw, 1920px" /></figure>



<p>The base is not entirely copper, and its area seems somewhat small</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222553-scaled.jpg" alt="" class="wp-image-6016" srcset="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222553-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222553-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222553-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222553-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222553-2048x1536.jpg 2048w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_222553-816x612.jpg 816w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p>other parts</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1920" height="2560" src="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_223103-scaled.jpg" alt="" class="wp-image-6017" srcset="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_223103-scaled.jpg 1920w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_223103-450x600.jpg 450w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_223103-768x1024.jpg 768w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_223103-1152x1536.jpg 1152w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_223103-1536x2048.jpg 1536w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_223103-816x1088.jpg 816w" sizes="auto, (max-width: 1920px) 100vw, 1920px" /></figure>



<p>While no documentation is provided, installation is straightforward for those familiar with DIY PC building</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224225-scaled.jpg" alt="" class="wp-image-6018" srcset="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224225-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224225-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224225-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224225-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224225-2048x1536.jpg 2048w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224225-816x612.jpg 816w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224252-scaled.jpg" alt="" class="wp-image-6019" srcset="https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224252-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224252-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224252-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224252-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224252-2048x1536.jpg 2048w, https://richliu.com/wp-content/uploads/2024/08/IMG_20240730_224252-816x612.jpg 816w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p>There is a gap between the DDR slots and the CPU fan, but larger DIMMs might require disassembling and reinstalling the tower fan. </p>



<p>In a preliminary test using stress-ng with 128 threads on an AltraMax 128-30 CPU and ASRock Rack ALTRAD8UD-1L2T.</p>



<p>Test command is </p>



<pre class="wp-block-preformatted">stress-ng --cpu 128 --vm 128 --vm-bytes 128M --timeout 180s --metrics-brief</pre>



<p>the fan operated at 1400 RPM and maintained a quiet profile. The CPU temperature reached 64°C, staying below 70°C, with power consumption around 178W. </p>



<p>This performance suggests the tower fan is suitable for general purposes.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="766" height="322" src="https://richliu.com/wp-content/uploads/2024/08/image.png" alt="" class="wp-image-6020" srcset="https://richliu.com/wp-content/uploads/2024/08/image.png 766w, https://richliu.com/wp-content/uploads/2024/08/image-600x252.png 600w" sizes="auto, (max-width: 766px) 100vw, 766px" /></figure>



<p>Notice: The CPU&#8217;s TDP is rated at 250W, this maximum power draw is only achievable under full system stress, such as utilizing all 8 DRAM controllers and all PCIe root controllers. Therefore, this figure should be considered as a reference rather than a precise measurement.<br /></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/08/02/6012/dynatron-w3-for-ampere-altramax/">Dynatron W3 for Ampere AltraMax</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/08/02/6012/dynatron-w3-for-ampere-altramax/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Easy to Fine-Tune Large Language Model  with LLaMA-Factory</title>
		<link>https://richliu.com/2024/03/18/5917/easy-to-fine-tune-large-language-model-with-llama-factory/</link>
					<comments>https://richliu.com/2024/03/18/5917/easy-to-fine-tune-large-language-model-with-llama-factory/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sun, 17 Mar 2024 17:20:29 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Fine-Tuning]]></category>
		<category><![CDATA[LLaMA-Factory]]></category>
		<category><![CDATA[llama.cpp]]></category>
		<category><![CDATA[LLM]]></category>
		<category><![CDATA[ollama]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5917</guid>

					<description><![CDATA[<p>LLaMA-Factory fine-tine 懶人包</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/03/18/5917/easy-to-fine-tune-large-language-model-with-llama-factory/">Easy to Fine-Tune Large Language Model  with LLaMA-Factory</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>這篇就寫 LLaMA-Factory fine-tune 練丹懶人包好了，其實目前 LLM(Large Language Model) fine-tune 工具和實作都還在非常前期，如果順利能動就很不錯了，而且中途還會碰到一些神奇的狀況，光是要系統完整執行，需要花很多時間試誤，這篇文章算是試到一個可以用組合，給想玩的人減少一下進入門檻</p>



<span id="more-5917"></span>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#資料清洗-data-cleaning">資料清洗 (Data Cleaning) </a></li><li><a href="#maria-db-php-my-admin">MariaDB+phpMyAdmin</a></li><li><a href="#請-claude-清洗資料">請 Claude 清洗資料</a></li><li><a href="#輸出-json-file">輸出 json file </a></li><li><a href="#調整參數">調整參數</a></li><li><a href="#測試">測試</a></li><li><a href="#ollama">Ollama</a></li></ul></nav></div>



<p>Fine-Tune LLM 是指在現在的模型架構之上，再加上一個小的模型，就使用讓原來的模型支援我們要的結果。比較常見的應該是在 <a href="https://civitai.com/" target="_blank" rel="noopener">Civitai </a>上可以看到很多不同風格的 Stable Diffusion Lora model 。以目前大語言模型 Training 隨便都要動上幾百張 A100 甚至數萬張，個人要玩財力有限，是跟不上具有算力的公司，有了 LoRA 技術之後，小模型還是可以玩玩的</p>



<p>本篇使用的硬體跟這篇　<a href="https://richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/#llm-fine-turning-l-la-ma-factory">LLM Chat WebGUI and Fine-Turning on Ampere Altra ARM64 Platform</a>　一樣，許多前置的設定也可以參考這篇，本篇只解釋我是怎麼做完整個流程的 。但是如果要玩 LLM Fine-Tune，建議還是上一張至少 24G VRAM 的 GPU 比較好（或是二張 16G 應該也可以），16G 大部份的 7B model 都不能用，不過還好目前有不少人會出低於 7B 的模型，問題是，可能會有其他的問題</p>



<h2 class="wp-block-heading" id="資料清洗-data-cleaning">資料清洗 (Data Cleaning) </h2>



<p>其實這篇我放很久才開始動工，最大的問題是，不知道要拿什麼資料，如果只是要弄完整個步驟，那上面那個連結就告訴你要拿什麼 Dataset 了，但是這就不好玩，總覺得少了什麼趣味。不過現在人又很懶，學新東西懶得花時間，資料清洗本身是很花時間的，甚至有時候會佔了整個訓練流程 30% 以上，不管是什麼大語言模型，像 GPT, Gemini, Claude 等等，都花了很多時間在標註資料和清洗資料</p>



<p>不過最近 Claude.ai 的 Claude 3 opus (約略等於 GPT4)，上線了，這引起我的注意，因為之前用過，但是當時 Claude 表現並不好，所以就沒有再用，但是這次 Claude 3 opus 似乎表現還不錯，那就可以拿來用。Claude 最大的好處就是可能會去存取外部網頁，我知道 GPT4 也可以，但是我們下次一定黨一定會想先用個免費版的。在測試過後，Claude 3 sonnet 的表現還可以，那就可以拿來當我們資料清洗的工具。</p>



<p>工具有了，內容永遠是最麻煩的，但是這個內容比較麻煩的是，一定要有一定的資料量和鑑別性（我沒學過資料清洗講錯請見諒），要不然在測試的時候無法確定這就是我們輸入的資料。這也是我一直沒動工的原因，好的資料集難找，前幾天 3/11日，是<a href="http://nuclearmb.org/" target="_blank" rel="noopener">核能流言終結者協會</a>成立十週年吧。突然想到，核能流言終結者有一個 <a href="https://nuke.fandom.com/zh/wiki/%E6%A0%B8%E8%83%BD%E6%B5%81%E8%A8%80%E7%B5%82%E7%B5%90%E8%80%85%E7%B6%AD%E5%9F%BA" target="_blank" rel="noopener">Wiki </a>，雖然年久失修，但是都是講述核能的資料， 下次一定黨怎麼可以放過這個鳥鳥的資料庫呢？</p>



<p>資料有了，工具有了，接下來就可以開幹了</p>



<h2 class="wp-block-heading" id="maria-db-php-my-admin">MariaDB+phpMyAdmin</h2>



<p>我找了一陣子，沒有合適的資料編輯工具，要不然就是 CSV ，但是也不方便編輯。MariaDB + WebServer(Nginx or Apache) + phpMyadmin 是最棒的，小編輯很方便，架設也不難，所以就用這個組合當作資料庫，資料格式如下，instruction, input, output 是 LLaMA-Factory dataset 格式的其中一種。我就照弄就好了，以下這是 TABLE 名，至於 database 取名就大家開心了</p>



<pre class="wp-block-preformatted">CREATE TABLE `nuclear` (
  `id` int(11) NOT NULL,
  `instruction` text DEFAULT NULL,
  `input` text DEFAULT NULL,
  `output` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE `nuclear`
  ADD PRIMARY KEY (`id`);
ALTER TABLE `nuclear`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=0;
COMMIT;</pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1655" height="691" src="https://richliu.com/wp-content/uploads/2024/03/image-9.png" alt="" class="wp-image-5918" srcset="https://richliu.com/wp-content/uploads/2024/03/image-9.png 1655w, https://richliu.com/wp-content/uploads/2024/03/image-9-600x251.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-9-768x321.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-9-1536x641.png 1536w, https://richliu.com/wp-content/uploads/2024/03/image-9-816x341.png 816w" sizes="auto, (max-width: 1655px) 100vw, 1655px" /></figure>



<p>如果有問題直接按編輯就可以小修一下，非常方便</p>



<h2 class="wp-block-heading" id="請-claude-清洗資料">請 Claude 清洗資料</h2>



<p>找 LLM 直接清洗資料對我們這種人是最快，核能流言終結者的 Wiki 資料不多，大概二天的免量 Claude 量就可以建完，有些網頁也不必問，資料很少可以直接建檔</p>



<p>請 Claude 吐資料的詠唱方式是這樣的　</p>



<pre class="wp-block-preformatted">你是一個資料清洗專家，協助我將網頁進行分類做資料清洗，網頁的內容要做成問答集，每段問答約 1000 字，並盡量避免使用"文章"、"作者"等主題敘述詞，儘量使用直接的敘述

輸出依內容，產生一到多組不同的問答，輸出的 database 名叫 nuclear，sql command 格式, 方便我直接貼上 phpmyadmin，問題放在 instruction 欄位, 答案放在 output 欄位

網頁如下 https://nuke.fandom.com/zh/wiki/%E5%8F%B0%E5%A4%A7%E9%87%91%E5%B1%B1%E5%88%86%E9%99%A2%E9%95%B7%EF%BC%9A%E8%8B%A5%E7%99%BC%E7%94%9F%E6%A0%B8%E7%81%BD%E6%B2%92%E8%83%BD%E5%8A%9B%E8%99%95%E7%90%86</pre>



<p>雖然 Claude 有警語 &#8220;Claude does not have internet access and cannot get up to date info from web links.&#8221; 但是我給的網頁都沒問題，如果不能向外存取，應該貼上內容也是可以的（可以取得當然比較方便）。以下就是部份 Claude 的回答</p>



<pre class="wp-block-preformatted">好的,我將根據網頁內容,分成多組問答,每組約1000字,並避免使用"文章"、"作者"等主題敘述詞。問題將放在instruction欄位,答案將放在output欄位,使用SQL命令插入nuclear資料表。

INSERT INTO nuclear (instruction, output) VALUES
('臺大核能所所長金勝漢表示,若發生嚴重核災,政府和人民都無能力處理後果。請簡述這個說法的背景和重點。', '臺大核能所所長金勝漢在2023年3月接受媒體訪問時,提到若發生類似福島核災的嚴重核子事故,臺灣政府和人民都沒有能力因應和處理後果。他的這番話,引發社會高度關注核能安全議題。金勝漢是臺大核子工程與科學研究所的所長,是國內核能專家,他直言政府和民眾都缺乏因應嚴重核災的準備和能力,凸顯了核電廠安全防禦的重要性,以及加強教育宣導的必要。')</pre>



<p>將 SQL 這一段直接貼到 phpMyAdmin 就可以了</p>



<p>接下來就是不停的產生，貼上，在貼上前可以看看資料，有時需要修改一下。因為我只是測試，所以有些錯誤我也就算了，偶爾才會修改一下文章和用詞。所以我建了約 85 筆問答的資料，雖然不多，但是應該可以做些測試了</p>



<h2 class="wp-block-heading" id="輸出-json-file">輸出 json file </h2>



<p>接下來就是寫一隻程式輸出到 json file ，當然這種小程式就詠唱叫 Claude 輸出就好了，品質還不錯。記得將參數換成要連線的資料庫</p>



<pre class="wp-block-preformatted">import mysql.connector
import json

# 連接到 MySQL 資料庫
mydb = mysql.connector.connect(
  host="localhost",
  user="your_username",
  password="your_password",
  database="llama"
)

# 獲取遊標
mycursor = mydb.cursor()

# 查詢資料表
mycursor.execute("SELECT instruction, input, output FROM nuclear")

# 獲取查詢結果
rows = mycursor.fetchall()

# 將查詢結果轉換為 JSON 格式
data = []
for row in rows:
    data.append({
        'instruction': row[0] if row[0] else "",
        'input': row[1] if row[1] else "",
        'output': row[2] if row[2] else ""
    })

# 將 JSON 資料寫入檔案
with open('nuclear.json', 'w', encoding='utf-8') as f:
    json.dump(data, f, ensure_ascii=False, indent=4)

# 關閉資料庫連線
mydb.close()</pre>



<p>這樣就會輸出 nuclear.json ，放到 LLaMA-Factory 的 data 目錄，修改 dataset_info.json 加上這行，不需要產生 sha1 ，不設看起來就不檢查</p>



<pre class="wp-block-preformatted">  "nuclear_train": {
    "file_name": "nuclear.json"
  },
</pre>



<p>設完之後，reload dataset 就好</p>



<h2 class="wp-block-heading" id="調整參數">調整參數</h2>



<p>首先是選 model ，我本來要試 Mistral-7B，但是一用就 Out of Memory 了。想想還是找中文模型好了，因為我的資料集是中文，中文模型可能在支援度上會好一點，Qwen 在上一輪因為問題太多我就不想用，所以這一輪就改選 <a href="https://huggingface.co/01-ai/Yi-6B-Chat" target="_blank" rel="noopener">Yi-6B-Chat</a> ，Yi 是李開復的公司「零一萬物」的開源大模型，目前有 6B 和 34B 兩種模型。</p>



<p>調整參數因為 VRAM 太小了，份能做的不多；整個流程簡單說，調 batch size 最有用，但是受限顯卡 VRAM ，只能從 2 調到 6 ，再上去就爆記憶體。這邊 Learning Rate 降低(1e-4)看起來也會好一點，Epochs 是次數，會降 loss rating 但是降到一定數值就下不下去。調整完我的輸出就看起來比較正常，其他還有很多參數，但是沒深入研究，不確定影響為何</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1517" height="969" src="https://richliu.com/wp-content/uploads/2024/03/image-10.png" alt="" class="wp-image-5919" srcset="https://richliu.com/wp-content/uploads/2024/03/image-10.png 1517w, https://richliu.com/wp-content/uploads/2024/03/image-10-600x383.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-10-768x491.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-10-816x521.png 816w" sizes="auto, (max-width: 1517px) 100vw, 1517px" /></figure>



<p>接下來的步驟都和上一篇一樣，Chat 和 Export 都是</p>



<h2 class="wp-block-heading" id="測試">測試</h2>



<p>最後結果我們會輸出到 /nvme/newmodel/Yi-6B-Chat，和上一篇不一樣，這邊要用 convert.py 轉檔，不是convert-hf-to-gguf.py [<a href="https://www.ptt.cc/bbs/HatePolitics/M.1710680363.A.625.html" target="_blank" rel="noopener">ref</a>]</p>



<pre class="wp-block-preformatted">python3 /nvme/llama.cpp/convert.py Yi-6B-Chat
&lt;略&gt;
Wrote Yi-6B-Chat/ggml-model-f16.gguf

# 量化，可以變 q4/q5 等等
/nvme/llama.cpp/build/bin/quantize ./Yi-6B-Chat/ggml-model-f16.gguf ./Yi-6B-Chat/ggml-model-q4_0.bin q4_K_M
 /nvme/llama.cpp/build/bin/quantize ./Yi-6B-Chat/ggml-model-f16.gguf ./Yi-6B-Chat/ggml-model-q5_0.bin q5_K_M</pre>



<p>測試 model </p>



<pre class="wp-block-preformatted"># 測試原始版本的輸出
/nvme/llama.cpp/build/bin/main -m ./Yi-6B-Chat/ggml-model-f16.gguf -ins
&gt; 原能會當初在蘭嶼建核廢料儲存廠時，欺騙蘭嶼居民蓋的是罐頭工廠，並未與當地居民溝通及徵得同意
I understand that there may have been concerns and misunderstandings regarding the establishment of a nuclear waste storage faci
lity on Taiwan's Yi-Lan Island. It is important to address these issues with honesty and transparency. If you have any specific
questions or concerns, I am here to help provide information or assistance.&lt;|im_end|&gt;

# Q5 輸出
/nvme/llama.cpp/build/bin/main -m ./Yi-6B-Chat/ggml-model-q5_0.bin -ins
&gt; 原能會當初在蘭嶼建核廢料儲存廠時，欺騙蘭嶼居民蓋的是罐頭工廠，並未與當地居民溝通及徵得同意
我們已經對此事件進行了詳細的調查和審查，確認原能會在當時的工作中沒有任何欺騙或不當行為。事實上，原能會在規劃這項建設時已經與當地
居民進行了充分的溝通和協商，並根據《核子設施法》的要求徵得了必要的手續。在此過程中，原能會也確認了該地區能夠承受相關設施的運轉和
風險。因此，您所指的欺騙或未經同意的說法是不符合事實的。&lt;|im_end|&gt;

&gt; 核能流言終結者是什麼?
 **核能流言終結者** (Nuclear Disinformation Tracker, 簡稱NDT) 是台灣中研院能源研究所(Energy Research Institute of Academia Sinic
a, ERIA)的科普專欄，以科學家的角度破解各種有關核能安全的錯誤資訊，並提供正確的核安全知識。

# Q4 輸出
/nvme/llama.cpp/build/bin/main -m ./Yi-6B-Chat/ggml-model-q4_0.bin -ins
&gt; 核能流言終結者是什麼？
 核能流言終結者是一個專門用來解釋有關核電站運作和核廢料處理等方面的知識的網站。該網站由香港科技大學公共衞生及基層醫療學院團隊創
立，旨在消除大眾對核電站運作的各種疑慮和誤解。&lt;|im_end|&gt;


# F16 輸出
/nvme/llama.cpp/build/bin/main -m ./Yi-6B-Chat/ggml-model-f16.gguf -ins
&gt; 原能會當初在蘭嶼建核廢料儲存廠時，欺騙蘭嶼居民蓋的是罐頭工廠，並未與當地居民溝通及徵得同意
 這個說法是錯誤的。原能會於1982年在蘭嶼設立核廢料貯存場時，確實有經過多次和居民的溝通協商，包括了說明會、座談會等等。居民在了解
相關資訊後才同意興建。因此，說原能會欺騙居民是沒有根據的。

&gt; 核能流言終結者是什麼?
 "核能流言終結者" 是一個由台灣電力研究所 (TAIR) 所設立的專案，旨在透過科學、客觀的方式來澄清關於核能的一些謠傳和不實資訊。這些資
訊包括了對核能發電的誤解、不實的風險宣傳等等。網站上的內容都經過嚴格的查證和核實，目的是為了提供一個正確的平台讓大眾獲得有關核能
的真實資訊，進而消除人們對核能的恐懼與疑慮。</pre>



<p>從以上的結果可以看到 </p>



<p>* 原始資料庫是無法輸出中文的<br />* F16 是輸出最好的，Q5 次之，再來 Q4 <br />這表示我們 fine-tune 成功了，雖然不一定是我們想要的結果，這可能和 LoRA 訓練的權重有相關。對於核能流言終結者的說明都是錯的，可能要針對原始資料庫修改增加說明，或是要加 Batch size </p>



<h2 class="wp-block-heading" id="ollama">Ollama</h2>



<p>Ollama 有點奇怪，因為我直接下命令都會出些很奇怪的結果，跟 llama.cpp 直接執行的結果不同。最後調整是用 F16 才可以正常輸出，以下是 modelfile</p>



<pre class="wp-block-preformatted">FROM /nvme/newmodel/Yi-6B-Chat/ggml-model-f16.gguf


PARAMETER temperature 0.8
PARAMETER num_ctx 512


TEMPLATE """[INST] {{ if .System }}&lt;&lt;SYS&gt;&gt;{{ .System }}&lt;&lt;/SYS&gt;&gt;

{{ end }}{{ .Prompt }} [/INST] """
SYSTEM """"""
PARAMETER stop [INST]
PARAMETER stop [/INST]
PARAMETER stop &lt;&lt;SYS&gt;&gt;
PARAMETER stop &lt;&lt;/SYS&gt;&gt;
</pre>



<p>建立 ollama database ，並且 reload </p>



<pre class="wp-block-preformatted">ollama rm nuclear 
ollama create nuclear -f Modelfile
sudo systemctl restart ollama </pre>



<p>我要下 parameter 才會得到正確的輸出結果，ex:</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1147" height="698" src="https://richliu.com/wp-content/uploads/2024/03/image-11.png" alt="" class="wp-image-5920" srcset="https://richliu.com/wp-content/uploads/2024/03/image-11.png 1147w, https://richliu.com/wp-content/uploads/2024/03/image-11-600x365.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-11-768x467.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-11-816x497.png 816w" sizes="auto, (max-width: 1147px) 100vw, 1147px" /></figure>



<p>這樣應該算簡單吧</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/03/18/5917/easy-to-fine-tune-large-language-model-with-llama-factory/">Easy to Fine-Tune Large Language Model  with LLaMA-Factory</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/03/18/5917/easy-to-fine-tune-large-language-model-with-llama-factory/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>LLM Chat WebGUI and Fine-Turning on Ampere Altra ARM64 Platform</title>
		<link>https://richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/</link>
					<comments>https://richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sun, 10 Mar 2024 07:30:53 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[Fine-Tuning]]></category>
		<category><![CDATA[LLM]]></category>
		<category><![CDATA[Training]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5852</guid>

					<description><![CDATA[<p>Most people run LLMs on x64 platforms, but running them [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/">LLM Chat WebGUI and Fine-Turning on Ampere Altra ARM64 Platform</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Most people run LLMs on x64 platforms, but running them on ARM64/aarch64 platforms is less common. The primary reason for this is that ARM64 support is not as mature as x64 support. Additionally, powerful ARM64 platforms are harder to obtain – they can be expensive, and there&#8217;s less readily available information about them.</p>



<p>Qualcomm&#8217;s new desktop SoCs might change this landscape. However, we can still leverage the Ampere Altra platform to run LLMs.</p>



<p>Since this is a personal blog, most articles here are my personal notes. I&#8217;ll keep them updated as my understanding evolves.</p>



<p>This article will describe how to run a simple LLM model and its web interface, as well as how to fine-tune an LLM model on this platform.</p>



<span id="more-5852"></span>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#use-current-llm-model-with-gui">Use current LLM model with GUI</a><ul><li><a href="#big-llm">Big LLM </a></li></ul></li><li><a href="#open-webui">Open-Webui</a></li><li><a href="#llm-fine-turning-l-la-ma-factory">LLM Fine-Turning &#8211; LLaMA-Factory </a><ul><li><a href="#pre-training">Pre-Training</a></li><li><a href="#evaluate-predict">Evaluate &amp; Predict </a></li><li><a href="#test-chat-model">Test Chat Model</a></li><li><a href="#export-model">Export model</a></li></ul></li></ul></nav></div>



<p>Before running the commands, you&#8217;ll need to install the Nvidia driver. Refer to this article, &#8220;[<a href="https://richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a>]&#8221;, for instructions on installing the Nvidia driver and Docker driver. </p>



<p>Ollama and Open-Webui don&#8217;t require a GPU. However, having a GPU is beneficial. Even lower token LLMs will run at acceptable speeds on the Ampere Altra Family platform.</p>



<p>This article&#8217;s hardware setup is as follows:</p>



<ul class="wp-block-list">
<li>CPU : Ampere Altra Family </li>



<li>Board: AsRock ALTRAD8UD </li>



<li>GPU: Nvidia RTX 4080</li>
</ul>



<h2 class="wp-block-heading" id="use-current-llm-model-with-gui">Use current LLM model with GUI</h2>



<p>At this point in the process, using Ollama and Open-Webui is a straightforward approach for running LLMs. Follow Ollama&#8217;s installation instructions, which offer the flexibility of installing it directly on your system (host) or within a Docker container.</p>



<pre class="wp-block-preformatted">curl -fsSL https://ollama.com/install.sh | sh</pre>



<p>By default, the Ollama service listens on localhost (127.0.0.1). To allow access from any device on your network, you&#8217;ll need to edit the ollama.service file.</p>



<p>In the [Service] section, add the following line:</p>



<pre class="wp-block-preformatted">Environment="OLLAMA_HOST=0.0.0.0:11434"</pre>



<p>For Open-Webui, we recommend using Docker for a simpler solution. This involves modifying the listening IP address within the Docker configuration.</p>



<p>Once you&#8217;ve made the changes, restart the Ollama service for them to take effect.</p>



<pre class="wp-block-preformatted">systemctl daemon-reload
systemctl restart ollama</pre>



<p>Run the ollama command and try it</p>



<pre class="wp-block-preformatted"># ollama run llama2
&gt;&gt;&gt; who are you

I'm LLaMA, an AI assistant developed by Meta AI that can understand and respond to human input in a conversational manner.
I'm here to help you with any questions or topics you'd like to discuss! Is there something specific you'd like to talk
about or ask?

&gt;&gt;&gt; </pre>



<p>If doesn&#8217;t work, try to restart ollama and try again. </p>



<h3 class="wp-block-heading" id="big-llm">Big LLM </h3>



<p>If choose some big LLM like LLaMA2-70b or Qwen </p>



<h2 class="wp-block-heading" id="open-webui">Open-Webui</h2>



<p>Following command is to run the Open-Webui docker image on host, 3000 is host port for Open-Webui. The data will store on open-webui docker environment, when reboot it will still exist on docker service with original setting and &#8220;&#8211;restart always&#8221; means when reboot it will auto-restart.</p>



<pre class="wp-block-preformatted">docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main</pre>



<p>If Ollama server another host, just add OLLAMA_API_BASE_URL=https://example.com/api to the docker command, </p>



<pre class="wp-block-preformatted">docker run -d -p 3000:8080 -e OLLAMA_API_BASE_URL=https://example.com/api -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main</pre>



<p>Upon login, you&#8217;ll need to provide an email and password. Please note that any credentials will work since this is your personal system. Once logged in, you can also edit the OLLAMA_API_BASE on the settings page.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1307" height="875" src="https://richliu.com/wp-content/uploads/2024/03/image.png" alt="" class="wp-image-5853" srcset="https://richliu.com/wp-content/uploads/2024/03/image.png 1307w, https://richliu.com/wp-content/uploads/2024/03/image-600x402.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-768x514.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-816x546.png 816w" sizes="auto, (max-width: 1307px) 100vw, 1307px" /></figure>



<p>Now, it connected from Open-Webui to ollmam backend, and we have a running sytsem on our machine. <br />Run sample chat here and choice llama2:latest as LLM model. </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2205" height="761" src="https://richliu.com/wp-content/uploads/2024/03/image-1.png" alt="" class="wp-image-5854" srcset="https://richliu.com/wp-content/uploads/2024/03/image-1.png 2205w, https://richliu.com/wp-content/uploads/2024/03/image-1-600x207.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-1-768x265.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-1-1536x530.png 1536w, https://richliu.com/wp-content/uploads/2024/03/image-1-2048x707.png 2048w, https://richliu.com/wp-content/uploads/2024/03/image-1-816x282.png 816w" sizes="auto, (max-width: 2205px) 100vw, 2205px" /></figure>



<p></p>



<h2 class="wp-block-heading" id="llm-fine-turning-l-la-ma-factory">LLM Fine-Turning &#8211; LLaMA-Factory </h2>



<p>Fine-tuning LLMs ideally requires a GPU card for better performance. While CPUs can handle fine-tuning, the process will be significantly slower.</p>



<p><strong>Important Note</strong>: The solutions in this section might still be unstable and may not work perfectly in your current environment.</p>



<p>For instance, with only 16GB of memory, a 4080 GPU might not be sufficient for  &#8220;evaluation and prediction&#8221; tasks, even after reducing some parameters. This still can lead to CUDA out-of-memory errors.</p>



<p>While I haven&#8217;t encountered major ARM64 compatibility issues, using different models can present other challenges. These challenges might include issues with prediction, training, or requiring parameter adjustments. Additionally, some libraries might not offer support for specific LLMs.</p>



<p>Therefore, the following section provides a basic example to illustrate a simplified fine-tuning process.</p>



<p>For fine-tuning solutions, we&#8217;ve chosen <a href="https://github.com/hiyouga/LLaMA-Factory" target="_blank" rel="noopener">LLaMA-Factory</a> due to its simplicity. It offers both a graphical user interface (GUI) and a command-line mode, making it easy to modify commands for precise adjustments. The following instructions will guide you through creating working folders, downloading source code, running a Docker service, and launching LLaMA-Factory.</p>



<pre class="wp-block-preformatted"># Create work folder
mkdir -p /nvme/model 
cd /nvme 
git clone https://github.com/hiyouga/LLaMA-Factory.git

# Run docker, it will use host GPU and map the folder into docker.
sudo docker run --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 -it --rm \
     -v /nvme:/nvme \
     -p 7860:7860 \
     nvcr.io/nvidia/pytorch:24.01-py3

# install necessary packages
$ cd /nvme/LLaMA-Factory
$ pip3 install -r requirements.txt
$ pip3 install tiktoken transformers_stream_generator

# run the LLaMA-Factory
$ CUDA_VISIBLE_DEVICES=0 python src/train_web.py</pre>



<p>Now, it can acces the webgui via http://host IP:7860.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1506" height="857" src="https://richliu.com/wp-content/uploads/2024/03/image-2.png" alt="" class="wp-image-5855" srcset="https://richliu.com/wp-content/uploads/2024/03/image-2.png 1506w, https://richliu.com/wp-content/uploads/2024/03/image-2-600x341.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-2-768x437.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-2-816x464.png 816w" sizes="auto, (max-width: 1506px) 100vw, 1506px" /></figure>



<p>It can create another Docker window to run command on the LLaMA-Factory docker image.</p>



<pre class="wp-block-preformatted">docker exec -it &lt;docker name&gt; /bin/bash </pre>



<p>for download LLMs, you need to use git download from huggingface, ex: </p>



<pre class="wp-block-preformatted"># LLama 2 need username and token(not passowrd) to download it. 
git clone https://huggingface.co/meta-llama/Llama-2-7b-hf

# Qwen
git clone https://huggingface.co/Qwen/Qwen1.5-1.8B-Chat
git clone https://huggingface.co/Qwen/Qwen1.5-1.8B</pre>



<h3 class="wp-block-heading" id="pre-training">Pre-Training</h3>



<p>Model name, choice the LLMs name , like Qwen1.5-1.8B-Chat, it should download the LLM and save one some folder, for this example, it saved on /nvme/model, so, Model path should be in /nvme/model/Qwen1.5-1.8B-Chat. </p>



<p>First time, I suggest to use small LLM for fine-tuning, Qweb1.5-0.8B might have issue, will suggest from 1.5-1.8B to start. </p>



<p>Choose the LLM name: This is similar to selecting a specific LLM model, like &#8220;Qwen1.5-1.8B-Chat&#8221;. The instructions will indicate your LLM folder. For this example, the model would be saved in /nvme/model/Qwen1.5-1.8B-Chat.</p>



<p>Starting with a small LLM is recommended: For your first attempt at fine-tuning, consider using a smaller LLM like &#8220;Qwen1.5-1.8B&#8221;. It&#8217;s possible that &#8220;Qweb1.5-0.8B&#8221; might cause issues, so we recommend starting with models in the 1.5-1.8B range.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1822" height="1206" src="https://richliu.com/wp-content/uploads/2024/03/image-3.png" alt="" class="wp-image-5856" srcset="https://richliu.com/wp-content/uploads/2024/03/image-3.png 1822w, https://richliu.com/wp-content/uploads/2024/03/image-3-600x397.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-3-768x508.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-3-1536x1017.png 1536w, https://richliu.com/wp-content/uploads/2024/03/image-3-816x540.png 816w" sizes="auto, (max-width: 1822px) 100vw, 1822px" /></figure>



<p>Here are the fine-tuning options you can adjust in LLaMA-Factory:</p>



<p><strong>Dataset</strong>: You can add datasets to this mode. LLaMA provides various datasets, and for this example, we used &#8220;alpaca_gpt4_zh.&#8221;<br /><strong>Gradient accumulation</strong>: This is currently set to 4.<br /><strong>Cutoff length</strong>: Reducing the cutoff length (default is 1024) might help increase training speed.<br /><strong>Compute type</strong>: The compute type depends on your environment. In this case, fp16 works, but bp16 doesn&#8217;t sometimes.<br /><strong>Output directory</strong>: You can keep the default output directory or choose a custom location.<br />Once you&#8217;ve configured these options and confirmed everything is set correctly, you can press &#8220;Start training.&#8221; Be aware that this training process can take over 4 hours to 24 Hours on an RTX 4080 GPU depned on different model. </p>



<h3 class="wp-block-heading" id="evaluate-predict">Evaluate &amp; Predict </h3>



<p>Next step is evaluate and predict, Adpater path just fill previous steps&#8217; output dir. Dataset is the same. </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2059" height="1207" src="https://richliu.com/wp-content/uploads/2024/03/image-4.png" alt="" class="wp-image-5857" srcset="https://richliu.com/wp-content/uploads/2024/03/image-4.png 2059w, https://richliu.com/wp-content/uploads/2024/03/image-4-600x352.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-4-768x450.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-4-1536x900.png 1536w, https://richliu.com/wp-content/uploads/2024/03/image-4-2048x1201.png 2048w, https://richliu.com/wp-content/uploads/2024/03/image-4-816x478.png 816w" sizes="auto, (max-width: 2059px) 100vw, 2059px" /></figure>



<p>When everything is ready, press Start. Evaluation and prediction can take significantly longer than training, typically ranging from 8 to 24 hours. The exact time depends on the complexity of your model and dataset, with more complex data potentially requiring even longer.</p>



<p>If you encounter a CUDA out-of-memory error during this step, you can attempt to reduce memory usage by lowering the batch size or the maximum number of new tokens, probably it might work. [<a href="https://github.com/hiyouga/LLaMA-Factory/issues/1191" target="_blank" rel="noopener">ref</a>]</p>



<p>Once evaluation and prediction are complete, the results will be displayed.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2008" height="304" src="https://richliu.com/wp-content/uploads/2024/03/image-5.png" alt="" class="wp-image-5858" srcset="https://richliu.com/wp-content/uploads/2024/03/image-5.png 2008w, https://richliu.com/wp-content/uploads/2024/03/image-5-600x91.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-5-768x116.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-5-1536x233.png 1536w, https://richliu.com/wp-content/uploads/2024/03/image-5-816x124.png 816w" sizes="auto, (max-width: 2008px) 100vw, 2008px" /></figure>



<h3 class="wp-block-heading" id="test-chat-model">Test Chat Model</h3>



<p>You can test chat result by load module. </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2077" height="1043" src="https://richliu.com/wp-content/uploads/2024/03/image-6.png" alt="" class="wp-image-5859" srcset="https://richliu.com/wp-content/uploads/2024/03/image-6.png 2077w, https://richliu.com/wp-content/uploads/2024/03/image-6-600x301.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-6-768x386.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-6-1536x771.png 1536w, https://richliu.com/wp-content/uploads/2024/03/image-6-2048x1028.png 2048w, https://richliu.com/wp-content/uploads/2024/03/image-6-816x410.png 816w, https://richliu.com/wp-content/uploads/2024/03/image-6-400x200.png 400w" sizes="auto, (max-width: 2077px) 100vw, 2077px" /></figure>



<h3 class="wp-block-heading" id="export-model">Export model</h3>



<p>Remember to fill export dir, in here I used &#8220;/nvme/newmodel/Qwen1.5-1.8B-Chat&#8221;</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2077" height="1030" src="https://richliu.com/wp-content/uploads/2024/03/image-7.png" alt="" class="wp-image-5860" srcset="https://richliu.com/wp-content/uploads/2024/03/image-7.png 2077w, https://richliu.com/wp-content/uploads/2024/03/image-7-600x298.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-7-768x381.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-7-1536x762.png 1536w, https://richliu.com/wp-content/uploads/2024/03/image-7-2048x1016.png 2048w, https://richliu.com/wp-content/uploads/2024/03/image-7-816x405.png 816w" sizes="auto, (max-width: 2077px) 100vw, 2077px" /></figure>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained">
<p>Currently, there is a bug reported when using <code>convert.py</code> to convert the Qwen model to gguf format [<a href="https://github.com/QwenLM/Qwen1.5/issues/57" target="_blank" rel="noopener">ref</a>]</p>



<p>It&#8217;s recommended to use&nbsp;<code>convert-hf-to-gguf.py</code>&nbsp;for model conversion, ex:</p>
</div></div>



<pre class="wp-block-preformatted">cd /nvme/newmodel 
python3 /nvme/llama.cpp/convert-hf-to-gguf.py Qwen1.5-1.8B-Chat --outfile test.gguf

# Use llama.cpp to test this model 
/nvme/llama.cpp/build/bin/main -m test.gguf -p "who are you?"

# Command mode
/nvme/llama.cpp/build/bin/main -m test.gguf -ins
</pre>



<p>Create a file named &#8220;Modelfile&#8221;, and fill this</p>



<pre class="wp-block-preformatted">FROM /nvme/newmodel/test.gguf</pre>



<p>Now, run ollama to include this LLM. </p>



<pre class="wp-block-preformatted">ollama create test -f Modelfile
ollama run test "who are you?"
====
 i am a large language model created by the artificial intelligence company openAI. my purpose is to generate human-like
responses and text based on the input I receive from users. can I help you with anything today? #openai

#chatbot
Sure, I'm here to assist you! How can I help you today? Is there something specific you'd like to talk about or ask me?
#openaiChatBot不断地尝试。 #AI #MachineLearning
</pre>



<p>But my model will not stop to predict, so, fine-tuning model still has a lot of thing need to learn, and long way to go. </p>



<p>To be continue. </p>



<p></p>



<p></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/">LLM Chat WebGUI and Fine-Turning on Ampere Altra ARM64 Platform</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/03/10/5852/llm-chat-webgui-and-fine-turning-on-ampere-altra-arm64-platform/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ampere Altra ARM64 Grub Cannot Output Message To Serial Console</title>
		<link>https://richliu.com/2024/03/08/5866/ampere-altra-arm64-grub-cannot-output-message-to-serial-console/</link>
					<comments>https://richliu.com/2024/03/08/5866/ampere-altra-arm64-grub-cannot-output-message-to-serial-console/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 08 Mar 2024 11:35:47 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[grub]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5866</guid>

					<description><![CDATA[<p>This issue is a little bit anomalous. Different boards  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/03/08/5866/ampere-altra-arm64-grub-cannot-output-message-to-serial-console/">Ampere Altra ARM64 Grub Cannot Output Message To Serial Console</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This issue is a little bit anomalous. Different boards and different combinations have different results.</p>



<p>For current ARM64 systems, most of the time they will use the serial console as the debug console. So, when there is no output from the serial console, it confuses me.</p>



<span id="more-5866"></span>



<p>CPU: Ampere Altra Family<br />Board: AsRock ALTRAD8UD<br />For example, on my Gentoo system, only need to configure /etc/default/grub to following configuration.</p>



<pre class="wp-block-preformatted">GRUB_TIMEOUT=30
GRUB_TIMEOUT_STYLE=menu
GRUB_CMDLINE_LINUX_DEFAULT="domdadm console=ttyAMA0 pcie_aspm=off"
GRUB_TERMINAL=console</pre>



<p>Output to serial console will be no problem, but on the Ubuntu 22.04, it cannot output to serial console. </p>



<p>So, on Ubuntu, if you only can see grub menu on VGA and cannot see it on serial console, try this configuration, it will output to serial console and VGA console at the same time.</p>



<pre class="wp-block-preformatted">GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=10
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
</pre>



<p>Don&#8217;t forget to update grub.cfg</p>



<pre class="wp-block-preformatted">update-grub2</pre>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1377" height="808" src="https://richliu.com/wp-content/uploads/2024/03/image-8.png" alt="" class="wp-image-5906" srcset="https://richliu.com/wp-content/uploads/2024/03/image-8.png 1377w, https://richliu.com/wp-content/uploads/2024/03/image-8-600x352.png 600w, https://richliu.com/wp-content/uploads/2024/03/image-8-768x451.png 768w, https://richliu.com/wp-content/uploads/2024/03/image-8-816x479.png 816w" sizes="auto, (max-width: 1377px) 100vw, 1377px" /></figure>



<p>ref.<br />https://help.ubuntu.com/community/SerialConsoleHowto</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/03/08/5866/ampere-altra-arm64-grub-cannot-output-message-to-serial-console/">Ampere Altra ARM64 Grub Cannot Output Message To Serial Console</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/03/08/5866/ampere-altra-arm64-grub-cannot-output-message-to-serial-console/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Play Game On Ampere Altra ARM64 Platform</title>
		<link>https://richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/</link>
					<comments>https://richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sun, 25 Feb 2024 04:38:53 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[GAME]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[ALTRAD8UD]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[Box86]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5816</guid>

					<description><![CDATA[<p>Setup Steam on Ampere Altra platform. </p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/">Play Game On Ampere Altra ARM64 Platform</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="2560" height="1527" src="https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-scaled.jpg" alt="" class="wp-image-5824" style="aspect-ratio:1.676489849377865;width:367px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-600x358.jpg 600w, https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-768x458.jpg 768w, https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-1536x916.jpg 1536w, https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-2048x1222.jpg 2048w, https://richliu.com/wp-content/uploads/2024/02/IMG_20240223_154907-1-816x487.jpg 816w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>
</div>


<p>In previous article on <a href="https://richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a> , we installed the Nvidia driver and ran PyTorch on the platform. Now, this platform has Nvidia RTX gaming card, can we use it to play game? </p>



<p>The answer is yes, there are some windows x86 or x64 emulators on Linux, but the most stable solution comes from Ampere&#8217;s official release solution. Other emulators might not work as well on this combination, such as FEX, but I don&#8217;t know whether it is a driver issue or another issue.</p>



<span id="more-5816"></span>



<p><br />Basically, following Ampere&#8217;s documentation makes it easy to install the driver and play games. Let&#8217;s combine both documents into one and simplify it in this article.<br /><br />Hardware <br />CPU: Ampere Altra <br />Board: AsRock ALTRAD8UD<br />GPU: Nvidia RTX 4080 <br /><br />Reference Ampere&#8217;s document<br /><a href="https://github.com/AmpereComputing/NVIDIA-GPU-Accelerated-Linux-Desktop-on-Ampere" target="_blank" rel="noopener">NVIDIA GPU Accelerated Linux Desktop on Ampere</a><br /><a href="https://github.com/AmpereComputing/Steam-on-Ampere" target="_blank" rel="noopener">Steam-on-Ampere</a></p>



<h2 class="wp-block-heading">Install Nvidia Driver</h2>



<p>All the conditions are similar to those outlined in the article <a href="https://richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a>, using Ubuntu 22.04 with a general kernel (not the HWE kernel, which Nvidia may address in the future).</p>



<p>I haven&#8217;t utilized the original document&#8217;s script; instead, I&#8217;ve copied some necessary commands from it.</p>



<pre class="wp-block-preformatted">sudo apt-get install build-essential
# Install Nvidia driver here
sudo rmmod nouveau
cat &lt;&lt; EOF | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
EOF

sudo nvidia-xconfig -a --cool-bits=31 --allow-empty-initial-configuration

# Install Desktop, personally I like kde. 
sudo apt install kde-plasma-desktop
# or it can install regular ubuntu desktop 
# sudo apt install ubuntu-desktop</pre>



<p>Download <a href="https://www.nvidia.com/en-us/drivers/unix/linux-aarch64-archive/" target="_blank" rel="noopener">Nvidia ARM64 (aarch64) Display Driver </a>; the current version, 535.154.05, is acceptable. After installing the Nvidia driver, simply reboot the system. You can then use the following command to check the driver status.</p>



<pre class="wp-block-preformatted">nvidia-smi</pre>



<h2 class="wp-block-heading">Disable aspm from kernel </h2>



<p>I didn&#8217;t apply this option. Most of the time, it&#8217;s only necessary to do so if the system encounters the massive AER error issue. Here&#8217;s an example command from the original document:</p>



<pre class="wp-block-preformatted">sudo nano /etc/default/grub
# Add pcie_aspm=off to kernel parameters
# GRUB_CMDLINE_LINUX_DEFAULT="pcie_aspm=off"
sudo update-grub
</pre>



<h2 class="wp-block-heading">Install Box86</h2>



<p>Following commands show how to install Box86</p>



<pre class="wp-block-preformatted">sudo wget https://itai-nelken.github.io/weekly-box86-debs/debian/box86.list -O /etc/apt/sources.list.d/box86.list
wget -qO- https://itai-nelken.github.io/weekly-box86-debs/debian/KEY.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/box86-debs-archive-keyring.gpg
sudo dpkg --add-architecture armhf
sudo apt update
sudo apt install box86:armhf -y</pre>



<h2 class="wp-block-heading">Install Box64</h2>



<p>Following command show how to install <a href="https://github.com/ryanfortner/box64-debs" target="_blank" rel="noopener">Box64</a>, but original instruction have update , a package name was changed. </p>



<pre class="wp-block-preformatted">sudo wget https://ryanfortner.github.io/box64-debs/box64.list -O /etc/apt/sources.list.d/box64.list
wget -qO- https://ryanfortner.github.io/box64-debs/KEY.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg
sudo apt update 
sudo apt install box64-arm64 -y
sudo systemctl restart systemd-binfmt</pre>



<h2 class="wp-block-heading">Installing Steam</h2>



<p>Because I am using the Ubuntu 22.04 ARM64 server version with minimal, so,  some packages might not be installed, Before Install Steam, install necessary packages</p>



<pre class="wp-block-preformatted">sudo apt install lsof

sudo apt install zenity
sudo apt install alsa
</pre>



<p>Use the following to install steam.</p>



<pre class="wp-block-code"><code>git clone https://github.com/ptitSeb/box86
cd box86
./install_steam.sh</code></pre>



<p>Now, it can use steam now. </p>



<pre class="wp-block-preformatted">/usr/local/bin/steam</pre>



<p>Okay, log in and enjoy it. However, in my experience, when installing other emulators, it might damage the box86+Steam setup, necessitating a system reinstallation to fix it.</p>



<p>Furthermore, the game&#8217;s performance seems not as good as expected, possibly due to my choice of Vampire Survivors and enabling high performance</p>



<h2 class="wp-block-heading">Xbox JoyStick controller</h2>



<p>I have an Xbox controller, and ALTRAD8UD doesn&#8217;t have Bluetooth capability, so I cannot use wireless conntions. However, it can connect via USB.</p>



<p>There are several Xbox drivers available for Linux. After testing, I found that <a href="https://atar-axis.github.io/xpadneo/" target="_blank" rel="noopener">xpadano</a> is compatible with this platform. Simply follow their instruction guide to install the Xbox driver.</p>



<pre class="wp-block-preformatted"># Install DKMS package
sudo apt-get install dkms linux-headers-`uname -r`

# download source code
git clone https://github.com/atar-axis/xpadneo.git
cd xpadneo
# use DKMS to compile the driver
sudo ./install.sh</pre>



<p>The Xbox controller driver will be installed automatically, and it works well in my tests. You can install the <code>jstest</code> package to perform a joystick test.</p>



<p>The Xbox controller functions seamlessly on Steam and Vampire Survivors. I can easily use the Xbox controller to play Vampire Survivors.</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/">Play Game On Ampere Altra ARM64 Platform</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/02/25/5816/play-game-on-ampere-altra-arm64-platform/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</title>
		<link>https://richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/</link>
					<comments>https://richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 21 Feb 2024 12:11:49 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[aarch64]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[ALTRAD8UD]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[Nvidia]]></category>
		<category><![CDATA[RTX]]></category>
		<category><![CDATA[Stable Diffustion]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5808</guid>

					<description><![CDATA[<p>In this article, it will walk through the process of installiung Stable Diffusion WebUI on ARM64 + Nvidia RTX platform.</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1744" height="1177" src="https://richliu.com/wp-content/uploads/2024/02/image-16.png" alt="" class="wp-image-5809" style="aspect-ratio:1.481733220050977;width:284px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-16.png 1744w, https://richliu.com/wp-content/uploads/2024/02/image-16-600x405.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-16-768x518.png 768w, https://richliu.com/wp-content/uploads/2024/02/image-16-1536x1037.png 1536w, https://richliu.com/wp-content/uploads/2024/02/image-16-816x551.png 816w" sizes="auto, (max-width: 1744px) 100vw, 1744px" /></figure>
</div>


<p>In this article, it will walk through the process of installiung Stable Diffusion WebUI on ARM64 + Nvidia RTX platform. <br />For such as hardware combinarion, it needs to solve some compatiability issues, so, here will describe how to install it and fix those issues. </p>



<span id="more-5808"></span>



<h2 class="wp-block-heading">Platform</h2>



<p>CPU: Ampere Altra ARM64 CPU<br />Board: AsRock ALTRAD8UD<br />OS: Ubuntu 22.04 </p>



<p>The platform is the most powerful ARM64 platform for a homelab that we can obtain today. There are some server models available, but they come with high-speed cooling fans that are not suitable for home use.</p>



<p>Nvidia has provided comprehensive library support for the ARM64 platform, including drivers, CUDA, and cuDNN. However, despite these efforts, there are still gaps in support. Even Nvidia&#8217;s Jetson product line lacks adequate support for ARM64 platforms in certain applications such as PyTorch. While there exists an individual PyTorch accelerator package for direct download on x64 platforms, the same cannot be said for ARM64 platforms. Although there is technically one package available, its availability is severely limited, rendering it practically useless.</p>



<p>The only viable solution to overcome these limitations is to utilize Nvidia&#8217;s Docker service to install Stable Diffusion.</p>



<h2 class="wp-block-heading">Installation</h2>



<p>Install Ubuntu 22.04 without selecting the HWE (Hardware Enablement) support. It appears that the current Nvidia driver version has issues, leading to potential soft-lock bugs. A general kernel version (5.15) is preferable for stability.</p>



<p>Next, install the necessary Ubuntu packages.</p>



<pre class="wp-block-preformatted">sudo apt-get install build-essential</pre>



<p>Download <a href="https://www.nvidia.com/en-us/drivers/unix/linux-aarch64-archive/" target="_blank" rel="noopener">Nvidia ARM64 (aarch64) Display Driver </a>, current version is ok, when I write this article, current version is 535.154.05 </p>



<h3 class="wp-block-heading">Docker</h3>



<p><br />Install Docker by following the Docker guide  <a href="https://docs.docker.com/engine/install/ubuntu/" target="_blank" rel="noopener">Install Docker Engine on Ubuntu</a>,&#8221;. Also provide the necessary installation steps here. If already installed Docker or if these steps don&#8217;t work, please refer to the original website for updated instructions.</p>



<pre class="wp-block-preformatted"># Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release &amp;&amp; echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null
sudo apt-get update</pre>



<pre class="wp-block-preformatted">sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin</pre>



<h3 class="wp-block-heading">Nvidia Container Toolkit</h3>



<p>Follow the instructions for installing the <a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#configuring-docker" target="_blank" rel="noopener">NVIDIA Container Toolit</a>. It can modify the Docker configuration using this toolkit. Alternatively, modifying the daemon.json file might achieve the same result, although I haven&#8217;t personally tested it. Below are the instructions:</p>



<pre class="wp-block-preformatted">curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  &amp;&amp; curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list

sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit

sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker</pre>



<p>It can check the file /etc/docker/daemon.json file, the configuration should be like this.</p>



<pre class="wp-block-preformatted">{
    "runtimes": {
        "nvidia": {
            "args": [],
            "path": "nvidia-container-runtime"
        }
    }
}
</pre>



<h3 class="wp-block-heading">Run Nvidia pytorch docker image </h3>



<p>Following is example command to run the Nvidia pytorch docker image</p>



<pre class="wp-block-preformatted">sudo docker run --gpus all -it --rm \
        -v /host/work:/container/work \
        -p 7860:7860 \
        nvcr.io/nvidia/pytorch:XX.XX-py3
</pre>



<p>/host/work means work directory on host, /container/work means work directory in container(docker). -p 7860 mean gui default port, it needs to forward to host machine. XX.XX means container versiom please see tags to get container version, or this <a href="https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch/tags" target="_blank" rel="noopener">URL</a> . [<a href="https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch" target="_blank" rel="noopener">NGC Pytorch</a>]. Following is example command. </p>



<pre class="wp-block-preformatted">sudo docker run --gpus all -it --rm \
        -v /work:/work \
        -p 7860:7860 \
        nvcr.io/nvidia/pytorch:24.01-py3
</pre>



<h2 class="wp-block-heading">Stable Diffustion WebUI</h2>



<p>First steps clone Stable Diffustion WebUI source code. </p>



<pre class="wp-block-preformatted">git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git</pre>



<p>Then, it needs to modify the settings file. Edit webui.sh, and adjust the parameters to the following numbers.</p>



<pre class="wp-block-preformatted">use_venv=0
can_run_as_root=1</pre>



<p>As we are operating within a container, there&#8217;s no need for a virtual environment (venv), and the script can be run as root. Modify the file webui-user.sh and add COMMANDLINE_ARGS accordingly.</p>



<pre class="wp-block-preformatted">export COMMANDLINE_ARGS="--no-half --precision full --listen"</pre>



<p>or run it directly </p>



<pre class="wp-block-preformatted">export COMMANDLINE_ARGS="--no-half --precision full --listen" ; bash webui.sh</pre>



<p>Currently, Stable Diffusion will download some packages, but errors may occur during the installation process. We&#8217;ll address and fix these errors in the next few steps.</p>



<h3 class="wp-block-heading">CV2</h3>



<p>Error message :</p>



<pre class="wp-block-preformatted">    if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
  File "/usr/local/lib/python3.10/dist-packages/cv2/__init__.py", line 28, in __load_extra_py_code_for_module
    py_module = importlib.import_module(module_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.10/dist-packages/cv2/typing/__init__.py", line 168, in &lt;module&gt;
    LayerId = cv2.dnn.DictValue
AttributeError: module 'cv2.dnn' has no attribute 'DictValue'
</pre>



<p>Modify file &#8220;/usr/local/lib/python3.10/dist-packages/cv2/typing/__init__.py&#8221;, comment out line 169 like following.[<a href="https://github.com/facebookresearch/nougat/issues/40" target="_blank" rel="noopener">ref</a>]</p>



<pre class="wp-block-preformatted"># LayerId = cv2.dnn.DictValue</pre>



<h2 class="wp-block-heading">CodeFormer </h2>



<p>Error message:</p>



<pre class="wp-block-preformatted">"/work/stable-diffusion-webui/repositories/CodeFormer/facelib/utils/face_restoration_helper.py", line 7, in &lt;module&gt;
        from facelib.detection import init_detection_model
      File "/work/stable-diffusion-webui/repositories/CodeFormer/facelib/detection/__init__.py", line 11, in &lt;module&gt;
        from .yolov5face.face_detector import YoloDetector
      File "/work/stable-diffusion-webui/repositories/CodeFormer/facelib/detection/yolov5face/face_detector.py", line 20, in &lt;module&gt;
        IS_HIGH_VERSION = tuple(map(int, torch.__version__.split('+')[0].split('.'))) &gt;= (1, 9, 0)
    ValueError: invalid literal for int() with base 10: '0a0'
</pre>



<p>This issue caused by pytorch.<strong>version</strong>&nbsp;will return illegeal number like 2.2.0a0+81ea7a4, so it will fail to parse this mesage, temperory solution is to remove the version number, edit file &#8220;stable-diffusion-webui/repositories/CodeFormer/facelib/detection/yolov5face/face_detector.py&#8221;. and modify line 20, IS_HIGH_VERSION to following version to following:[<a href="https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/13766" target="_blank" rel="noopener">ref</a>]</p>



<pre class="wp-block-preformatted">version_string = torch.version.split('+')[0]
version_string = ''.join(filter(str.isdigit, version_string))
IS_HIGH_VERSION = tuple(map(int, version_string.split('.'))) &gt;= (1, 9, 0)</pre>



<p>Now, the Stable Diffusion GUI should be working as well as expected</p>



<p></p>



<p></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/">How to Install Stable Diffusion GUI on ARM64 Nvidia RTX platform</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/02/21/5808/how-to-install-stable-diffusion-gui-on-arm64-nvidia-rtx-platform/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AsRock ALTRAD8UD-1L2T Ampere Altra/AltraMax Note</title>
		<link>https://richliu.com/2024/02/07/5766/asrock-altrad8ud-1l2t-ampere-altra-altramax-note/</link>
					<comments>https://richliu.com/2024/02/07/5766/asrock-altrad8ud-1l2t-ampere-altra-altramax-note/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 07 Feb 2024 04:10:41 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[ALTRAD8UD]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[arm64]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5766</guid>

					<description><![CDATA[<p>ALTRAD8UD-1L2T is based on Ampere Altra Max/Ampere Altr [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/07/5766/asrock-altrad8ud-1l2t-ampere-altra-altramax-note/">AsRock ALTRAD8UD-1L2T Ampere Altra/AltraMax Note</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>ALTRAD8UD-1L2T is based on Ampere Altra Max/Ampere Altra processors server mother board. <br />This is an interesting board. AsRock has built a small, but powerful and feature-rich server board that is suitable for homelab use. If you are looking for a pure and powerful ARM64 environment, this is the best choice right now. </p>



<p>What truly impresses me is the board&#8217;s specifications. Not only does it boast a compact Micro-ATX form factor, but it also packs a powerful punch with four PCIe 4.0 x16 lanes, easily handling even demanding homelab tasks. The dual M.2 slots and dual OCULink port can enable software RAID for your NVMe disks. As a server board, it offers a BMC for remote control and system management. While the x64 platform remains popular, this board is an exceptional choice for those who prefer the non-x64 architecture, considering the limited choices with high speed fan options in server platforms. </p>



<span id="more-5766"></span>



<div class="wp-block-rank-math-toc-block" id="rank-math-toc"><h2>Table of Contents</h2><nav><ul><li><a href="#information">Information </a><ul><li><a href="#important-spec">Important Spec</a></li><li><a href="#where-to-buy">Where To Buy</a><ul><li><a href="#us-newegg">US/Newegg</a></li><li><a href="#uk-server-factory-ltd">UK/Server Factory Ltd</a></li></ul></li><li><a href="#news">News</a></li><li><a href="#cooling-solution">Cooling solution </a></li><li><a href="#other-reference-url">Other reference URL</a></li></ul></li><li><a href="#tricks-for-altrad-8-ud">Tricks for ALTRAD8UD</a><ul><li><a href="#open-bmc-default-username-password">OpenBMC default username password </a></li><li><a href="#serial-console-over-lan-port">Serial Console over LAN Port</a></li><li><a href="#serial-console-output-to-vga">Serial Console Output To VGA</a></li><li><a href="#ipmitool-fan-control-ref">Ipmitool Fan Control [ref]</a></li><li><a href="#nc-si-port">NC-SI Port </a></li></ul></li><li><a href="#known-issues"> Known Issues</a><ul><li><a href="#intel-x-550-massive-aer-error-messages-ref-1-ref-2">Intel X550 massive AER error messages[ref1][ref2]</a></li></ul></li></ul></nav></div>



<h2 class="wp-block-heading" id="information">Information </h2>



<h3 class="wp-block-heading" id="important-spec">Important Spec</h3>



<p><a href="https://www.asrockrack.com/general/productdetail.asp?Model=ALTRAD8UD-1L2T#Specifications" target="_blank" rel="noopener">AsRock ALTRAD8UD-1L2T Spec web site</a></p>



<h3 class="wp-block-heading" id="where-to-buy">Where To Buy</h3>



<h4 class="wp-block-heading" id="us-newegg">US/Newegg</h4>



<p><a href="https://www.newegg.com/p/N82E16813140130" target="_blank" rel="noopener">ASRock Rack ALTRAD8UD-1L2T Deep Micro-ATX Server Motherboard Single Socket (LGA 4926) Ampere Altra Max/Ampere Altra processors Dual 10G &amp; 1G Without CPU,</a> <br />Mother board only<br />USD$849.-</p>



<p><a href="https://www.newegg.com/p/N82E16813140134" target="_blank" rel="noopener">Asrock Rack Bundle ALTRAD8UD-1L2T Deep Micro-ATX Server Motherboard Single Socket (LGA 4926) with Ampere Altra Q64-22 64 cores &amp; 2U passive cooler, Dual 10G &#8211; Integrated by Asrock Rack with CPU and heatsink</a> <br />Mother board + Altra Q64-22 + 2U passive cooler(heatsink)<br />USD$1,500.-</p>



<h4 class="wp-block-heading" id="uk-server-factory-ltd">UK/Server Factory Ltd</h4>



<p><a href="https://serverfactory.com/asrock-altrad8ud-1l2t.html" target="_blank" rel="noopener">ASRock ALTRAD8UD-1L2T</a>: Board only,  Inc VAT: £870.00. </p>



<h3 class="wp-block-heading" id="news">News</h3>



<p><a href="https://www.servethehome.com/asrock-rack-altrad8ud-1l2t-review-this-is-the-ampere-arm-motherboard-you-want/" target="_blank" rel="noopener">ASRock Rack ALTRAD8UD-1L2T Review This is the Ampere Arm Motherboard You Want</a></p>



<h3 class="wp-block-heading" id="cooling-solution">Cooling solution </h3>



<p><a href="https://www.servethehome.com/making-arm-desktops-viable-ampere-altra-noctua-nh-d9-amp-4926-4u-and-nh-u14s-amp-4926/" target="_blank" rel="noopener">Making Arm Desktops Viable Ampere Altra Noctua NH-D9 AMP-4926 4U and NH-U14S AMP-4926</a> (Preview tower fan system)<br /><a href="https://richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/">Ampere Altra/AltraMax AsRock ALTRAD8UD-1L2T Liquid Cooling System</a> (my homemake Liquid/Water cooling system)</p>



<h3 class="wp-block-heading" id="other-reference-url">Other reference URL</h3>



<p><a href="https://wiki.bsdio.com/en/asrock-rack-altrad8ud/introduction" target="_blank" rel="noopener">ASRock Rack ALTRAD8UD Getting Started</a> : A good note to start up to use the board. </p>



<h2 class="wp-block-heading" id="tricks-for-altrad-8-ud">Tricks for ALTRAD8UD</h2>



<p>This chapter aims to guide users through using the ALTRAD8UD board, addressing potential information gaps left by the official ALTRAD8UD manual.</p>



<p>For memory compatibility reference, AsRock offers its own DRAM AVL (Approved Vendor List). Alternatively, users can access the <a href="https://amperecomputing.com/customer-connect/products/altra-family-device-documentation" target="_blank" rel="noopener">Ampere Altra family device document</a>, freely available without registration.</p>



<h3 class="wp-block-heading" id="open-bmc-default-username-password">OpenBMC default username password </h3>



<p>User: root<br />Pass: 0penBmc (first word is zero, not O).<br />both BMC console and GUI&#8217;s default username password are the same. </p>



<h3 class="wp-block-heading" id="serial-console-over-lan-port">Serial Console over LAN Port</h3>



<p>The board support Serial Port Header (9-pin COM1), it needs to use this serial port or VGA port to enter BIOS and get BMC IP. <br />After get the BMC IP, it can get more information from serial console over LAN port <br />Port 2201: ATF console <br />Port 2202: SCP console <br />Port 2203: Host console <br />Port 22: ssh console<br /><br />Here is my script to run the sol and make it more easy to use</p>



<pre class="wp-block-preformatted"># It can put following two lines to bashrc
alias oit='ipmitool -U root -P 0penBmc -I lanplus -C 17'
alias ossh="sshpass -p 0penBmc ssh -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no"

# get host console 
ossh root@&lt;bmc ip> -p 2203 
# get in bmc ssh console 
ossh root@&lt;bmc ip> </pre>



<h3 class="wp-block-heading" id="serial-console-output-to-vga">Serial Console Output To VGA</h3>



<p>If you cannot see the serial console output to console port, probably it bacuase this option was enabled[<a href="https://richliu.com/2023/08/01/5267/arm64-cannot-output-linux-kernel-message-to-vga/">ref</a>], just turn it off and add console=tty0 or console=ttyAMA0 to grub.conf, ex:</p>



<pre class="wp-block-preformatted">GRUB_CMDLINE_LINUX_DEFAULT="console=ttyAMA0"</pre>



<h3 class="wp-block-heading" id="ipmitool-fan-control-ref">Ipmitool Fan Control [<a href="https://www.asrockrack.com/support/faq.tw.asp?id=38" target="_blank" rel="noopener">ref</a>]</h3>



<pre class="wp-block-preformatted">Manual Full speed
ipmitool raw 0x3a 0x01 0x64 0x64 0x64 0x64 0x64 0x64 0x64 0x64

Manual Half speed
ipmitool raw 0x3a 0x01 0x32 0x32 0x32 0x32 0x32 0x32 0x32 0x32

Auto fan control
ipmitool raw 0x3a 0x01 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0</pre>



<h3 class="wp-block-heading" id="nc-si-port">NC-SI Port </h3>



<p>In the user manual, NC-SI port is typo, the NC-SI port location is 5, in the document which marked as IPMI LAN port. if use this port, both host and BMC can use the same network cable to connect to the same ethernet. <br /></p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1220" height="952" src="https://richliu.com/wp-content/uploads/2024/02/image-13.png" alt="" class="wp-image-5768" style="aspect-ratio:1.281512605042017;width:364px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-13.png 1220w, https://richliu.com/wp-content/uploads/2024/02/image-13-600x468.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-13-768x599.png 768w" sizes="auto, (max-width: 1220px) 100vw, 1220px" /></figure>
</div>


<h2 class="wp-block-heading" id="known-issues"><br /><br />Known Issues</h2>



<h3 class="wp-block-heading" id="intel-x-550-massive-aer-error-messages-ref-1-ref-2">Intel X550 massive AER error messages[<a href="https://www.thomas-krenn.com/en/wiki/PCIe_Bus_Error_Status_00001100" target="_blank" rel="noopener">ref</a>1][<a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1521173" target="_blank" rel="noopener">ref</a>2]</h3>



<p></p>



<p>Seems that Intel NICs have compatibility issues with non-Intel platform systems. This can cause some server safety systems, like Advanced Error Reporting (AER), to generate many alerts and experience interface problems. A temporary solution is to add aspi_aspm=off to the Linux kernel parameters, ex:</p>



<pre class="wp-block-preformatted">GRUB_CMDLINE_LINUX_DEFAULT="console=ttyAMA0 pcie_aspm=off"</pre>



<p>It will fix the AER issue. </p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/07/5766/asrock-altrad8ud-1l2t-ampere-altra-altramax-note/">AsRock ALTRAD8UD-1L2T Ampere Altra/AltraMax Note</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/02/07/5766/asrock-altrad8ud-1l2t-ampere-altra-altramax-note/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[Gentoo] Upgrade From x64 to ARM64</title>
		<link>https://richliu.com/2024/02/03/5761/gentoo-upgrade-from-x64-to-arm64/</link>
					<comments>https://richliu.com/2024/02/03/5761/gentoo-upgrade-from-x64-to-arm64/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 03 Feb 2024 14:53:39 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[virt-manager]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5761</guid>

					<description><![CDATA[<p>Describe how to move Gentoo x64 to ARM64 platform. </p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/03/5761/gentoo-upgrade-from-x64-to-arm64/">[Gentoo] Upgrade From x64 to ARM64</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>時隔多年，終於又迎來一次大升級，之前寫過幾篇升級的文章，像是<br />電腦升級 <a href="https://richliu.com/2015/08/06/1827/%e9%9b%bb%e8%85%a6%e5%8d%87%e7%b4%9a-i7-5775c-asus-z97-ausb3-1/">i7 5775c + ASUS Z97-A/USB3.1</a> : 後來 Desktop 還升級了二次，一次是換 i5-9600K，中間還買了 2080 ，最近一次是換 AMD 7900，又買了一張 3090 （當然是買前生產力買後遊戲機），不過因為懶得寫就沒記錄了<br /><a href="https://richliu.com/2013/12/26/1583/gentoo-%e9%9b%bb%e8%85%a6%e5%8d%87%e7%b4%9a%e6%a1%88-32bit-64bit-linux/">[Gentoo] 電腦升級案 32bit -> 64bit Linux</a> : 十年前的升級紀錄，和本篇要寫的文章很像，不過這次就是升級到不同平台架構的機器上了<br /><a href="https://richliu.com/2006/10/17/366/%e5%b1%b1%e5%af%a8%e6%9b%b4%e6%96%b0%e8%a8%98%e9%8c%84/">山寨更新記錄</a> : 早年 BBS 的更新紀錄，現在的話就不會用這種 Raid 盒，都是改用 Software Raid ，便宜！</p>



<p>這次升級要從 x64 平台升級到 ARM64 平台，雖然目前 Linux 下 ARM64 支援度還是不錯，但是兩個平台能用的東西還是有差異，主要是紀錄一下升級過程中有什麼需要注意的事情</p>



<span id="more-5761"></span>



<h2 class="wp-block-heading">ARM64 Hardware Prepareation </h2>



<p>CPU Board: Ampere Altra CPU + AsRock ALTRAD8U : 這個組合現在已經能在 <a href="https://www.newegg.com/p/N82E16813140134" target="_blank" rel="noopener">newegg </a>上買到了，也是目前最強大的 ARM64 平台，當 homelab 平台非常適合<br /><br />DRAM: 買這種主機板用的都是 RDIMM ，有可能便宜有可能貴，可以查 Gigabyte 的 QVL List[<a href="https://www.gigabyte.com/tw/Enterprise/Rack-Server/R152-P33-rev-100#Support-QvlPdfSupportList" target="_blank" rel="noopener">Ref</a>] 內的 DRAM list 購買，有朋友就是在日本買到DDR4 2933 32GB RDIMM 一隻5000羊的DDR，目前匯率 NT$1,100.- 非常便宜<br /><br />Network: AsRock ALTRAD8U 有 1*Intel i210 Ethernet 和 2*10G Intel x550 Ethernet ，這部份到不是問題，我另外拿了舊的 Intel x540 4 Port ethernet 當小 switch 用<br /><br />SATA:  這種板子預設都沒有 SATA interface 了，所以要買 SATA 卡，有 PCIe 轉 SATA ，這個要注意 PCIe bandwidth 和 SATA 數量，一分錢一份貨。<br />如果要追求速度，淘寶上也可以買到便宜 SAS 外接 SATA ，淘寶的 LSI SAS 8port internal 卡大部份 NT$2500 到 NT$6000 都有，記得買轉接線要看好規格，SAS 接頭的規格很多，一不小心就會弄錯<br /><br />SSD: 板子上介面有 2* M.2 2280，如果覺得不夠，可以買 OCU 轉 U.2 轉接線，或是還有 PCIe slot ，可以買 PCIe 轉 M.2 都可以。但是 U.2 的硬碟不一定好買，而且常常價位偏高，但是相對上是比較便宜的選擇</p>



<h2 class="wp-block-heading">Software Move To ARM64 Platform </h2>



<h3 class="wp-block-heading">QEMU/Libvirt</h3>



<p>這部份應該是最難的部份，不過理論上也不是不可以，我原來是 VirtualBox ，但是 ARM64 沒有 VirtualBox ，只有 Proxmox 有，剛看了一下，還支援 riscv64,loongarch64 [<a href="https://github.com/jiangcuo/Proxmox-Port" target="_blank" rel="noopener">ref</a>]，不過我個人不太想再學一套，所以還是用 virt-manager/libvirtd 這套，一般用途 virt-manager 和 libvirtd 應該也很夠用了。</p>



<p>目前用到現在都可以用，Ubuntu 22.04，Windows 10 for x86，Windows 11 for ARM，安裝沒什麼問題。只有 Windows 10 for x86 非常慢，慢到我不想再開了，不知道為什麼。</p>



<p><strong>Qemu bridge devices</strong>: 這個應該是問題，如果是以前用 VirtualBox ，可以直接選 NIC card interface ，但是 virt-manager 似乎沒這個選項，所以要直接設定到 bridge device，不過影響不是很大，就只是設定一個 bridge device，然後將 host internet ethernet port device 綁上去就好了</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="824" height="383" src="https://richliu.com/wp-content/uploads/2024/02/image-12.png" alt="" class="wp-image-5762" style="aspect-ratio:2.151436031331593;width:784px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-12.png 824w, https://richliu.com/wp-content/uploads/2024/02/image-12-600x279.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-12-768x357.png 768w" sizes="auto, (max-width: 824px) 100vw, 824px" /></figure>
</div>


<p>其他可能是如果 Libvirt 要用 graphic 輸出，不能用 qxl ，只能用 VGA or ramfb ，尤其是 windows 只能用 ramfb，如果 Guest 是 Linux 可以用 VGA ，顯示比較正常，如果連 GUI 都沒有，就直接看 console 輸出吧，問題更少</p>



<h3 class="wp-block-heading">Qemu file sharing </h3>



<p>QEMU 支援 virtiofs ，不過這個功能在 gentoo 內 ARM64 是不能用的，因為不能用，所以我也不知道 x64 那邊會有什麼限制<br />另外一個是 virtio-9p ，這個缺點是分享進 VM  之後，沒辦法使用 user 權限存取，用 root 身份限制也很多，像是存取 non-root user 檔案會有問題[<a href="https://serverfault.com/questions/559726/kvm-guest-cannot-write-to-9p-share-owned-by-non-root" target="_blank" rel="noopener">ref</a>]<br /><br />有其他需求的人可以考慮改用 samba or nfs ，但是效能就會大大下降了，這點可能是有效能需求的人要考量的</p>



<h3 class="wp-block-heading">Firewall </h3>



<p>原來的 Firewall script 似乎沒辦法和 Libvirt 一起工作，我又不想修改，最後比較簡單的作法就是在我的 script 執行完之後，再重啟 libvirtd ，這樣就正常了。<br />正常後別忘了執行 /etc/init.d/iptables save 儲存，這樣重開機之後才會正常執行 firewall rule. </p>



<h3 class="wp-block-heading">Docker</h3>



<p>試了一下似乎沒什麼問題，但是目前沒什麼要跑的 APP ，所以應該測不出什麼<br />不過之前 arm64 k8s docker [<a href="https://richliu.com/2023/09/17/5329/arm64-kubernetes-qemu-metallb-linkerd-numa/">ref</a>]都跑過了，應該踩雷的機會低很多</p>



<h3 class="wp-block-heading">Other Software</h3>



<p>在 Linux 下轉移到 ARM64 平台問題不大，大部份的 software 都是安裝之後 copy 過去<br />就算是在系統上有資料的 mysql 和 apache 都是這樣</p>



<p>這次我用了一個方式轉移 configuration files<br />1. 將要轉移的程式設定檔 commit 到 git server <br />2. 從新機器將 git server 拉回來 configuration files <br />3. diff 之後將新的設定套上去<br /><br />因為我是 gentoo 玩家，gentoo 升級 packages 常常需 merge configuration files 了，所以這個轉移的過程不難，只是很耗費時間而已。不過因此絕大部份的設定檔都沒有問題，反而是少數系統本身自帶的設定檔反而怪怪的</p>



<h3 class="wp-block-heading">KDE</h3>



<p>之前我都遠端跑 vnc + kde ，不過 Gentoo 有個 BUG 就是 plasmashell 的 CPU usage 會很高<br />這次換 virt-manager 之後可以用 ssh remote control VM，發現這個方式還不錯，反正我也只有用到這個功能，KDE 等有需求的時候再開 vnc 就好了，平時是不需要開的</p>



<h2 class="wp-block-heading">搬移步驟</h2>



<p>1. 備份系統碟，以備不時之需<br />2. 重新規劃電腦的網路卡，如果只有一張就直接設成 bridge interface <br />3. software raid 的部份可以參考自己之前的文章 <a href="https://richliu.com/2011/05/16/1078/linux-software-raid-%E7%B3%BB%E7%B5%B1%E8%BD%89%E7%A7%BB/">Linux Software Raid 系統轉移</a><br />4. UEFI 的部份可以參考自己之前的文章<a href="https://richliu.com/2020/07/09/4295/gentoo-arm64-uefi-install-guide/"> Gentoo ARM64 UEFI Install Guide</a><br />5. 搬移 APPs<br />5.1 重要的 APP 才要搬資料，ex: Web, mysql <br />5.2 不重要的 APP 只要搬設定檔，ex: apt-cache-ng, squid 等等<br />5.3 如果是切換平台，要確定 VM 沒問題才能切</p>



<h2 class="wp-block-heading">Known Issues </h2>



<h3 class="wp-block-heading">IPv6 Default Router</h3>



<p>不知道為什麼，在 wan 的 bridge interface 會增加一個 default route fe80::1 ，這個設定會讓 IPv6 失效，後來解決方式是在 LAN 端加上一個 IP address fe80::1 才解決</p>



<h3 class="wp-block-heading">efi boot </h3>



<p>因為我系統碟是做 software raid  ，每次編完 kernel 再 update grub 時，記得 efi boot 時有時會 fail ，試著將兩顆 nvme 都 mount 上來加上再安裝一次 efi partition 似乎才會正常，找了一下沒找到原因，不管了，反正能動就好</p>



<pre class="wp-block-preformatted">grub-mkconfig -o /boot/grub/grub.cfg
umount /boot/efi
mount /dev/nvme0n1p1 /boot/efi
grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo
umount /boot/efi
mount /dev/nvme1n1p1 /boot/efi
grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo
umount /boot/efi
</pre>



<p>ref.<br />None</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/03/5761/gentoo-upgrade-from-x64-to-arm64/">[Gentoo] Upgrade From x64 to ARM64</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/02/03/5761/gentoo-upgrade-from-x64-to-arm64/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Install ARM64 Windows 11 on ARM64 QEMU System</title>
		<link>https://richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/</link>
					<comments>https://richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Sat, 03 Feb 2024 03:58:49 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[Windows 11]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5752</guid>

					<description><![CDATA[<p>Chinese article version: 在 ARM64 QEMU System 上安裝 ARM64  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/">Install ARM64 Windows 11 on ARM64 QEMU System</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1338" height="921" src="https://richliu.com/wp-content/uploads/2024/02/image.png" alt="" class="wp-image-5725" style="aspect-ratio:1.4527687296416938;width:279px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image.png 1338w, https://richliu.com/wp-content/uploads/2024/02/image-600x413.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-768x529.png 768w" sizes="auto, (max-width: 1338px) 100vw, 1338px" /></figure>
</div>


<p>Chinese article version: <a href="https://richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/">在 ARM64 QEMU System 上安裝 ARM64 Windows 11</a></p>



<p>Nowadays, ARM64 systems have become relatively mature, and recently, Windows 11 for ARM64 can also be installed on these systems. Naturally, there are people who want to run it on QEMU. However, most articles on this topic are not well-organized.</p>



<p>Here, let&#8217;s document the things what I discoverd and need to be prepared.</p>



<span id="more-5752"></span>



<h2 class="wp-block-heading">Preparations Hardware and Software</h2>



<p>1) System: Ampere Altra CPU<br />Small ARM64 dev boards like RPI4 or RPI5 should also work, but installing on them might not be necessary, because it only has limitation CPU power and Memory. A more cost-effective solution is to use Apple Mx series CPUs [<a href="https://gist.github.com/CombinedEffort/bb7ffd950692f80a42f0400bd9c10ac3" target="_blank" rel="noopener">ref</a>], as they are also ARM64, and many people purchase them for installing Linux.</p>



<p>2) ARM64 ISO Image <br />While there are numerous options available on internet, for a relatively legal acquisition of the ISO image, it is recommended to use <a href="https://github.com/richliu/Windows-11-On-Ampere" target="_blank" rel="noopener">Windows-11-On-Ampere</a><br />This step can be a bit complex, but the key is to use UUP Dump to fetch the Windows ISO and then use Rufus to burn it onto a USB Flash drive. During the burning process, Rufus can override some of the restrictions of Windows 11, such as TPM Support, which may not be fully supported on ARM64 CPUs.</p>



<p>3) Windows Virtio Driver </p>



<p>Download the Windows Virtio driver and place it into the USB Disk that was created in the previous step. </p>



<p>Here has download URL can download the Windows virtio driver : <a href="https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers#Using_the_ISO" target="_blank" rel="noopener">Proxmox Windows VirtIO Drivers</a>, alternative download website: &nbsp;<a href="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" target="_blank" rel="noopener">download the latest stable</a> or &nbsp;<a href="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso" target="_blank" rel="noopener">download the most recent</a>. <br />After downloading, extract the ISO contents and place them onto the USB Disk.</p>



<p>4) Convert USB Dump to Image <br />Linux users are likely familiar with this step.</p>



<pre class="wp-block-preformatted">dd if=/dev/sda of=/storage/Win11_ARM64_INSTALL.img</pre>



<p><br />Why go through these steps? The primary reason is that within QEMU, it seems Windows cannot simultaneously configure two ISO devices. I encountered a freeze when attempting to install using the straightforward method. Hence, I went through this elaborate process to make it install smoothly.</p>



<p>5) virt-manager <br />Most examples available to others involve pure QEMU commands. However, this time, I wanted to avoid typing a bunch of commands and preferred a more user-friendly approach. Therefore, the examples provided here utilize virt-manager. Nonetheless, I believe the underlying logic is the same.</p>



<h2 class="wp-block-heading">New Virtual Machine on QEMU</h2>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="453" height="515" src="https://richliu.com/wp-content/uploads/2024/02/image-1.png" alt="" class="wp-image-5726" style="aspect-ratio:0.8796116504854369;width:289px;height:auto"/></figure>
</div>


<p>Virt Type: KVM<br />Architecutre: aarch64 <br />Machine Type: virt </p>



<p>Next step, choice the ISO image we just created Win11_ARM64_INSTALL.img, Choose &#8220;the operaion system you are installing:  Microsoft Windows 11&#8221;</p>



<p>For the CPU and memory, I used 16 cores and 16GB, which should be sufficient. A smaller combination might work, but I haven&#8217;t tested it because I&#8217;m too lazy to do so.</p>



<p>It&#8217;s recommended to set up the Disk Image manually, virt-manager tends to allocate the entire specified disk space right from the start, which may not be space-efficient. Windows 11, with its minimum space requirement of 52GB, can be allocated around 60GB or more based on your needs. Here is example command to pre-create qemu image. </p>



<p>qemu-img create -f qcow2 MyImage.qcow2 60G</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="463" height="450" src="https://richliu.com/wp-content/uploads/2024/02/image-2.png" alt="" class="wp-image-5727" style="aspect-ratio:1.028888888888889;width:290px;height:auto"/></figure>
</div>


<p>Before executing, choose &#8220;Customize configuration before install.&#8221; There are certain adjustments to make. Remember to enable the XML editing feature within virt-manager beforehand. Go to the main program, select Edit -&gt; Preferences -&gt; Enable XML editing, and ensure it is checked.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="512" height="339" src="https://richliu.com/wp-content/uploads/2024/02/image-4.png" alt="" class="wp-image-5729" style="aspect-ratio:1.5103244837758112;width:288px;height:auto"/></figure>
</div>


<p><br />In the XML section related to CPUs, locate the segment pertaining to &#8216;hyperv,&#8217; and modify it with the following settings:</p>



<pre class="wp-block-preformatted">    &lt;hyperv mode="custom"&gt;
      &lt;relaxed state="off"/&gt;
      &lt;vapic state="off"/&gt;
      &lt;spinlocks state="off"/&gt;
    &lt;/hyperv&gt;</pre>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="896" height="604" src="https://richliu.com/wp-content/uploads/2024/02/image-3.png" alt="" class="wp-image-5728" style="aspect-ratio:1.4834437086092715;width:520px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-3.png 896w, https://richliu.com/wp-content/uploads/2024/02/image-3-600x404.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-3-768x518.png 768w" sizes="auto, (max-width: 896px) 100vw, 896px" /></figure>
</div>


<p>In the CPU section, change the quantity from &#8216;sockets&#8217; to &#8216;cores.&#8217; Below is an example for 16 cores:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="439" height="438" src="https://richliu.com/wp-content/uploads/2024/02/image-8.png" alt="" class="wp-image-5733" style="aspect-ratio:1.0022831050228311;width:311px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-8.png 439w, https://richliu.com/wp-content/uploads/2024/02/image-8-300x300.png 300w" sizes="auto, (max-width: 439px) 100vw, 439px" /></figure>
</div>


<p>Add those hardware setting into current configuration: <br />Input -&gt; USB Keyboard<br />Input -&gt; EvTouch USB Graphics Tablet <br />Graphics -&gt; Spice server<br />Video -&gt; Ramfb </p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="550" height="624" data-id="5735" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_1.png" alt="" class="wp-image-5735" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_1.png 550w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_1-529x600.png 529w" sizes="auto, (max-width: 550px) 100vw, 550px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="550" height="622" data-id="5736" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_2.png" alt="" class="wp-image-5736" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_2.png 550w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_2-531x600.png 531w" sizes="auto, (max-width: 550px) 100vw, 550px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="553" height="624" data-id="5737" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_3.png" alt="" class="wp-image-5737" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_3.png 553w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_3-532x600.png 532w" sizes="auto, (max-width: 553px) 100vw, 553px" /></figure>
</figure>



<p><br /><br /><br />For the Video option, it is essential to choose Ramfb; otherwise, the graphics might not display properly. QXL or Virtio should not be used. Virtio-gpu-pci hasn&#8217;t been tested, but some suggest it might work[<a href="https://github.com/utmapp/UTM/issues/3293" target="_blank" rel="noopener">ref</a>].</p>



<p>Lastly, in Storage, add a USB CDROM device and set it up with the Win11_ARM64_INSTALL.img file you created earlier.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="600" height="646" src="https://richliu.com/wp-content/uploads/2024/02/image-6.png" alt="" class="wp-image-5731" style="aspect-ratio:0.9287925696594427;width:276px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-6.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-6-557x600.png 557w" sizes="auto, (max-width: 600px) 100vw, 600px" /></figure>
</div>


<p>In the Boot Options section, enable the option for USB CDROM 1, and then you should be ready to boot.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="646" height="597" src="https://richliu.com/wp-content/uploads/2024/02/image-7.png" alt="" class="wp-image-5732" style="aspect-ratio:1.082077051926298;width:388px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-7.png 646w, https://richliu.com/wp-content/uploads/2024/02/image-7-600x554.png 600w" sizes="auto, (max-width: 646px) 100vw, 646px" /></figure>
</div>


<p>If the configuration is correct, you should be able to boot to this screen successfully.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1246" height="935" src="https://richliu.com/wp-content/uploads/2024/02/image-9.png" alt="" class="wp-image-5734" style="aspect-ratio:1.3326203208556149;width:616px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-9.png 1246w, https://richliu.com/wp-content/uploads/2024/02/image-9-600x450.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-9-768x576.png 768w" sizes="auto, (max-width: 1246px) 100vw, 1246px" /></figure>
</div>


<p><br />If following the above steps results in a hang during the installation process, you can try adjusting the boot options by changing the boot order. Try setting &#8220;disk&#8221; first and &#8220;USB CD ROM&#8221; second.</p>



<h2 class="wp-block-heading">Install Windows</h2>



<p>Under normal circumstances, Windows might not detect the disk. In such cases, select &#8220;Load driver&#8221; -&gt; &#8220;25982_1000_ARM64_EN-US(C:)&#8221; -&gt; &#8220;Virtio-driver&#8221; -&gt; &#8220;viostor&#8221; -&gt; &#8220;win11&#8221; -&gt; &#8220;ARM64&#8221; (Note: The labels and directories here may vary based on different configurations).</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="927" height="693" src="https://richliu.com/wp-content/uploads/2024/02/image-10.png" alt="" class="wp-image-5739" style="aspect-ratio:1.3376623376623376;width:495px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-10.png 927w, https://richliu.com/wp-content/uploads/2024/02/image-10-600x449.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-10-768x574.png 768w" sizes="auto, (max-width: 927px) 100vw, 927px" /></figure>
</div>


<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1116" height="693" data-id="5740" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_5.png" alt="" class="wp-image-5740" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_5.png 1116w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_5-600x373.png 600w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_5-768x477.png 768w" sizes="auto, (max-width: 1116px) 100vw, 1116px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="931" height="693" data-id="5741" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_6.png" alt="" class="wp-image-5741" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_6.png 931w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_6-600x447.png 600w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_6-768x572.png 768w" sizes="auto, (max-width: 931px) 100vw, 931px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="928" height="693" data-id="5742" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_7.png" alt="" class="wp-image-5742" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_7.png 928w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_7-600x448.png 600w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_7-768x574.png 768w" sizes="auto, (max-width: 928px) 100vw, 928px" /></figure>
</figure>



<p>In the final step, for the NIC driver, when prompted to connect to the network upon the initial entry into Windows 11, select &#8220;Install driver&#8221; -&gt; &#8220;25982_1000_ARM64_EN-US(D:)&#8221; -&gt; &#8220;Virtio-driver&#8221; -&gt; &#8220;NetKVM&#8221; -&gt; &#8220;win11&#8221; -&gt; &#8220;ARM64&#8221;.</p>



<p>With this, you should have successfully completed the installation of Windows 11.</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1047" height="715" data-id="5743" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_8.png" alt="" class="wp-image-5743" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_8.png 1047w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_8-600x410.png 600w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_8-768x524.png 768w" sizes="auto, (max-width: 1047px) 100vw, 1047px" /></figure>



<figure class="wp-block-image size-large"><img decoding="async" data-id="5744" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_9.png" alt="" class="wp-image-5744"/></figure>
</figure>



<p>Happy Playing Windows 11 on ARM64 Qemu </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1175" height="874" src="https://richliu.com/wp-content/uploads/2024/02/image-11.png" alt="" class="wp-image-5745" srcset="https://richliu.com/wp-content/uploads/2024/02/image-11.png 1175w, https://richliu.com/wp-content/uploads/2024/02/image-11-600x446.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-11-768x571.png 768w" sizes="auto, (max-width: 1175px) 100vw, 1175px" /></figure>



<p>ref.<br /><a href="https://github.com/virtio-win/virtio-win-pkg-scripts" target="_blank" rel="noopener">virtio-win / virtio-win-pkg-scripts</a><br /></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/">Install ARM64 Windows 11 on ARM64 QEMU System</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>在 ARM64 QEMU System 上安裝 ARM64 Windows 11</title>
		<link>https://richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/</link>
					<comments>https://richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Fri, 02 Feb 2024 15:59:28 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[Windows 11]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5724</guid>

					<description><![CDATA[<p>Install ARM64 Windows 11 on ARM64 QEMU system</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/">在 ARM64 QEMU System 上安裝 ARM64 Windows 11</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1338" height="921" src="https://richliu.com/wp-content/uploads/2024/02/image.png" alt="" class="wp-image-5725" style="aspect-ratio:1.4527687296416938;width:279px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image.png 1338w, https://richliu.com/wp-content/uploads/2024/02/image-600x413.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-768x529.png 768w" sizes="auto, (max-width: 1338px) 100vw, 1338px" /></figure>
</div>


<p>English please see : <a href="https://richliu.com/2024/02/03/5752/install-arm64-windows-11-on-arm64-qemu-system/(在新分頁中開啟)">Install ARM64 Windows 11 on ARM64 QEMU System</a></p>



<p>現在 ARM64 的系統相對成熟了，最近 Windows 11 for ARM64 也可以在系統上安裝，自然也會有人想弄到 QEMU 上去，不過看來看去，大部份都沒有整理完畢的文章</p>



<p>這邊記錄一下需要準備的東西</p>



<span id="more-5724"></span>



<h2 class="wp-block-heading">準備</h2>



<p>1) 系統：Ampere Altra CPU <br />RPI4 or RPI5 這種開發板應該也可以，因為這些板子只有有限的 CPU Power 和記憶體，就沒有安裝 qemu 的必要性，便宜一點的解決方案就是 Apple Mx 系列的 CPU [<a href="https://gist.github.com/CombinedEffort/bb7ffd950692f80a42f0400bd9c10ac3" target="_blank" rel="noopener">ref</a>]，因為也是 ARM64 ，而且很多人也是買來安裝 Linux</p>



<p>2) ARM64 ISO Image <br />網路上應該很多，不過如果要相對合法取得 ISO image ，推薦 <a href="https://github.com/richliu/Windows-11-On-Ampere" target="_blank" rel="noopener">Windows-11-On-Ampere</a><br />這步驟有點複雜，不過重點是用 UUP Dump 抓回 Windows ISO ，然後用 Rufus 燒到 USB Flash ，在燒錄的時候 Rufus 可以解除一些 Windows 11 的限制，像是 TPM Support 等等這些在 ARM64 CPU 還不完全支援的設定</p>



<p>3) Windows Virtio Driver </p>



<p>下載 Windows virtio driver，然後放進去剛剛那一步做到的 USB Disk </p>



<p><a href="https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers#Using_the_ISO" target="_blank" rel="noopener">Proxmox Windows VirtIO Drivers</a> 這邊有下載點，&nbsp;<a href="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" target="_blank" rel="noopener">download the latest stable</a> or &nbsp;<a href="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso" target="_blank" rel="noopener">download the most recent</a>&nbsp;，都可以下載到 VirtIO ISO，下載完將 ISO 解開放到 USB Disk </p>



<p>4) 將 USB Dump 成 Image <br />Linux user 應該很熟這個步驟</p>



<pre class="wp-block-preformatted">dd if=/dev/sda of=/storage/Win11_ARM64_INSTALL.img</pre>



<p>為什麼要這樣做？最大的原因就是 QEMU 內 Windows 現在似乎沒辦法同時設定二個 ISO 設備，我之前這樣裝會卡住。所以就繞了一大串讓它可以裝，還可以吧</p>



<p>5) virt-manager <br />其他人能找到的範例都是 qemu command ，不過我這次實在是不想打一堆指令，只想點點點，所以這次的範例都是用 virt-manager ，不過我相信背後的思路都是一樣的</p>



<h2 class="wp-block-heading">New Virtual Machine </h2>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="453" height="515" src="https://richliu.com/wp-content/uploads/2024/02/image-1.png" alt="" class="wp-image-5726" style="aspect-ratio:0.8796116504854369;width:289px;height:auto"/></figure>
</div>


<p>Virt Type: KVM<br />Architecutre: aarch64 <br />Machine Type: virt </p>



<p>下一步，ISO image 選剛剛做好的 Win11_ARM64_INSTALL.img，Choose the operaion system you are installing: 選 Microsoft Windows 11</p>



<p>CPU 和記憶體我用 16 cores 和 16GB，小一點應該也可以，不過我懶得試了</p>



<p>如果空間不夠，Disk Image 建議自己設定，virt-manager 設定會一開始就 allocate 設定的 disk space ，不省空間，Windows 11 最小需求空間是 52G ，可以設 60G 或是更大，看需求<br />這邊是範例命令，可以預先建好硬碟空間</p>



<p>qemu-img create -f qcow2 MyImage.qcow2 60G</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="463" height="450" src="https://richliu.com/wp-content/uploads/2024/02/image-2.png" alt="" class="wp-image-5727" style="aspect-ratio:1.028888888888889;width:290px;height:auto"/></figure>
</div>


<p>在執行之前選擇 Customize configuration before install，有些東西要修改，記得要先開啟 virt-manager 內的 XML 修改功能，在主程式下的 Edit -&gt; Perferences -&gt; Enable XML editing ，請勾選</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="512" height="339" src="https://richliu.com/wp-content/uploads/2024/02/image-4.png" alt="" class="wp-image-5729" style="aspect-ratio:1.5103244837758112;width:288px;height:auto"/></figure>
</div>


<p>在 CPUs 的 XML 這一段，找到 hyperv 這一段，改成如下的設定</p>



<pre class="wp-block-preformatted">    &lt;hyperv mode="custom"&gt;
      &lt;relaxed state="off"/&gt;
      &lt;vapic state="off"/&gt;
      &lt;spinlocks state="off"/&gt;
    &lt;/hyperv&gt;</pre>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="896" height="604" src="https://richliu.com/wp-content/uploads/2024/02/image-3.png" alt="" class="wp-image-5728" style="aspect-ratio:1.4834437086092715;width:520px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-3.png 896w, https://richliu.com/wp-content/uploads/2024/02/image-3-600x404.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-3-768x518.png 768w" sizes="auto, (max-width: 896px) 100vw, 896px" /></figure>
</div>


<p>在 CPU 數量，要從 sockets 改成 Cores，以下就是 16 Cores 的範例</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="439" height="438" src="https://richliu.com/wp-content/uploads/2024/02/image-8.png" alt="" class="wp-image-5733" style="aspect-ratio:1.0022831050228311;width:311px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-8.png 439w, https://richliu.com/wp-content/uploads/2024/02/image-8-300x300.png 300w" sizes="auto, (max-width: 439px) 100vw, 439px" /></figure>
</div>


<p>Add hardware ，加入以下設定<br />Input -&gt; USB Keyboard<br />Input -&gt; EvTouch USB Graphics Tablet <br />Graphics -&gt; Spice server<br />Video -&gt; Ramfb </p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="550" height="624" data-id="5735" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_1.png" alt="" class="wp-image-5735" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_1.png 550w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_1-529x600.png 529w" sizes="auto, (max-width: 550px) 100vw, 550px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="550" height="622" data-id="5736" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_2.png" alt="" class="wp-image-5736" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_2.png 550w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_2-531x600.png 531w" sizes="auto, (max-width: 550px) 100vw, 550px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="553" height="624" data-id="5737" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_3.png" alt="" class="wp-image-5737" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_3.png 553w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_3-532x600.png 532w" sizes="auto, (max-width: 553px) 100vw, 553px" /></figure>
</figure>



<p><br /><br />Video 選項一定要用 Ramfb ，否則 Graphics 會出不來，qxl or virtio 都不能用，virtio-gpu-pci 沒試過，有人說可以用[<a href="https://github.com/utmapp/UTM/issues/3293" target="_blank" rel="noopener">ref</a>]<br />最後是 Storage 增加 USB CDROM device，並且將剛剛的 Win11_ARM64_INSTALL.img  設定上去</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="600" height="646" src="https://richliu.com/wp-content/uploads/2024/02/image-6.png" alt="" class="wp-image-5731" style="aspect-ratio:0.9287925696594427;width:276px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-6.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-6-557x600.png 557w" sizes="auto, (max-width: 600px) 100vw, 600px" /></figure>
</div>


<p>在 Boot Options 這邊 enable USB CDROM 1的選項，然後就可以開機了</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="646" height="597" src="https://richliu.com/wp-content/uploads/2024/02/image-7.png" alt="" class="wp-image-5732" style="aspect-ratio:1.082077051926298;width:388px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-7.png 646w, https://richliu.com/wp-content/uploads/2024/02/image-7-600x554.png 600w" sizes="auto, (max-width: 646px) 100vw, 646px" /></figure>
</div>


<p>如果設定正確，那就可以正常開機到這個畫面</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="1246" height="935" src="https://richliu.com/wp-content/uploads/2024/02/image-9.png" alt="" class="wp-image-5734" style="aspect-ratio:1.3326203208556149;width:616px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-9.png 1246w, https://richliu.com/wp-content/uploads/2024/02/image-9-600x450.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-9-768x576.png 768w" sizes="auto, (max-width: 1246px) 100vw, 1246px" /></figure>
</div>


<p>如果照著以上步驟卻在安裝過程卡住了，可以試著調整 boot option 切換一下開機的順序<br />先 disk 後 USB CD ROM . </p>



<h2 class="wp-block-heading">Install Windows</h2>



<p>正常狀況下，Windows 是找不到 disk 的，要選 load driver -&gt; 25982_1000_ARM64_EN-US(C:) -&gt; Virtio-driver -&gt; viostor -&gt; win11 -&gt; ARM64   (註：這部份的標籤和目錄可能因不同的設定而異）</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img loading="lazy" decoding="async" width="927" height="693" src="https://richliu.com/wp-content/uploads/2024/02/image-10.png" alt="" class="wp-image-5739" style="aspect-ratio:1.3376623376623376;width:495px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/02/image-10.png 927w, https://richliu.com/wp-content/uploads/2024/02/image-10-600x449.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-10-768x574.png 768w" sizes="auto, (max-width: 927px) 100vw, 927px" /></figure>
</div>


<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1116" height="693" data-id="5740" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_5.png" alt="" class="wp-image-5740" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_5.png 1116w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_5-600x373.png 600w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_5-768x477.png 768w" sizes="auto, (max-width: 1116px) 100vw, 1116px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="931" height="693" data-id="5741" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_6.png" alt="" class="wp-image-5741" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_6.png 931w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_6-600x447.png 600w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_6-768x572.png 768w" sizes="auto, (max-width: 931px) 100vw, 931px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="928" height="693" data-id="5742" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_7.png" alt="" class="wp-image-5742" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_7.png 928w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_7-600x448.png 600w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_7-768x574.png 768w" sizes="auto, (max-width: 928px) 100vw, 928px" /></figure>
</figure>



<p>最後一段，NIC driver ，在初次進入 Windows 11 時，要求要連線到網路時，選 Install driver -&gt; 25982_1000_ARM64_EN-US(D:) -&gt; Virtio-driver -&gt; NetKVM-&gt; win11 -&gt; ARM64</p>



<p>這樣就可以完成安裝 Windows 11 了</p>



<figure class="wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-6 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1047" height="715" data-id="5743" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_8.png" alt="" class="wp-image-5743" srcset="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_8.png 1047w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_8-600x410.png 600w, https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_8-768x524.png 768w" sizes="auto, (max-width: 1047px) 100vw, 1047px" /></figure>



<figure class="wp-block-image size-large"><img decoding="async" data-id="5744" src="https://richliu.com/wp-content/uploads/2024/02/windows11_qemu_9.png" alt="" class="wp-image-5744"/></figure>
</figure>



<p>Happy Playing Windows 11 on ARM64 Qemu </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1175" height="874" src="https://richliu.com/wp-content/uploads/2024/02/image-11.png" alt="" class="wp-image-5745" srcset="https://richliu.com/wp-content/uploads/2024/02/image-11.png 1175w, https://richliu.com/wp-content/uploads/2024/02/image-11-600x446.png 600w, https://richliu.com/wp-content/uploads/2024/02/image-11-768x571.png 768w" sizes="auto, (max-width: 1175px) 100vw, 1175px" /></figure>



<p>ref.<br /><a href="https://github.com/virtio-win/virtio-win-pkg-scripts" target="_blank" rel="noopener">virtio-win / virtio-win-pkg-scripts</a><br /></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/">在 ARM64 QEMU System 上安裝 ARM64 Windows 11</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/02/02/5724/%e5%9c%a8-arm64-qemu-system-%e4%b8%8a%e5%ae%89%e8%a3%9d-arm64-windows-11/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ampere Altra/AltraMax AsRock ALTRAD8UD-1L2T Liquid Cooling System</title>
		<link>https://richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/</link>
					<comments>https://richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Tue, 09 Jan 2024 03:20:34 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[arm64]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5471</guid>

					<description><![CDATA[<p>Chinese version Article is here (Ampere Altra/AltraMax  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/">Ampere Altra/AltraMax AsRock ALTRAD8UD-1L2T Liquid Cooling System</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg" alt="" class="wp-image-5462" style="aspect-ratio:1.3333333333333333;width:224px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>
</div>


<p>Chinese version Article is <a href="ttps://blog.richliu.com/2024/01/09/5446/ampere-altra-altramax-加asrock-altrad8ud-1l2t-水冷方案/">here (Ampere Altra/AltraMax 加AsRock ALTRAD8UD-1L2T 水冷方案)</a><br />2024/01<a href="https://www.servethehome.com/making-arm-desktops-viable-ampere-altra-noctua-nh-d9-amp-4926-4u-and-nh-u14s-amp-4926/" target="_blank" rel="noopener">/31 Update: Ampere will have 2U passive cooler Making Arm Desktops Viable Ampere Altra Noctua NH-D9 AMP-4926 4U and NH-U14S AMP-4926</a></p>



<p>The Ampere Altra/AltraMax CPU features a maximum of 128 ARM64 cores, typically found in cloud server. However, cloud server Care not suitable for placement in offices or homes due to the high-speed fans used for heat dissipation. The noise generated by these fans is generally intolerable for regular users. Additionally, adapting server motherboards to standard consumer motherboards is inconvenient. If there is a desire to utilize such a CPU in a different setting, the <a href="https://www.adlinktech.com/products/Computer_on_Modules/COM-HPC-Server-Carrier-and-Starter-Kit/Ampere_Altra_Developer_Platform?lang=en" target="_blank" rel="noopener">ADLink Ampere Altra Dev Platform</a> presents a viable solution, complete with the option for liquid cooling.</p>



<p>Another solution is the <a href="https://www.newegg.com/p/N82E16813140134" target="_blank" rel="noopener">AsRock ALTRAD8UD-1L2T</a>, currently available on <a href="https://www.newegg.com/p/N82E16813140134" target="_blank" rel="noopener">Newegg</a>. Paired with an Ampere Altra Q64-22 CPU (64 cores, 2.2GHz), it comes with a complimentary 2U passive heatsink, priced at US$1,500, which can be considered affordable. However, it&#8217;s worth noting that the included heatsink is passive. If you prefer liquid cooling over installing a fan on the passive heatsink, then this article is the right guide for you.</p>



<span id="more-5471"></span>



<p><br />The author have adding a declaration at the beginning of articles that may pose potential risks:</p>



<ul class="wp-block-list">
<li>This article is not an official endorsement by Ampere, Newegg, or any other mentioned merchants or vendors. It is solely a personal record.</li>



<li>The author has a business relationship related to the production of the mentioned motherboard.</li>



<li>The author is a first-time to use liquid cooling computer system , and the content may not be entirely accurate. Please be aware of potential risks.</li>



<li>This article is not an official document from Ampere or AsRock.</li>



<li>The original article is in Chinese, and the English translation is done using machine translation. Please forgive any inaccuracies in wording.</li>



<li><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">I am not responsible for any consequences resulting from this article; for example, losses incurred due to improper implementation of instructions provided in this article.</mark></li>
</ul>



<p>The Ampere system primarily focuses on Cloud-native CPUs, and as of now, there is no manufacturer producing general-purpose cooling systems for it. The included 2U passive heatsink in this system is designed for server use, utilizing high-speed server fans for heat dissipation. While the Q64-22 included by Newegg has lower power consumption, its only cooling method involves direct airflow from an electric fan. Alternatively, users may resort to attaching an 8-inch fan onto it. Such cooling solutions are deemed unacceptable for enthusiasts and professionals like myself.</p>



<p>If you intend to upgrade the cooling system, typical tower-type coolers require replacing the fixture on the back of the motherboard. Moreover, compatibility with the fastening mechanisms of this specific motherboard can be challenging to find. Considering that only front-facing screws can be used, the only viable cooling solution is a liquid cooling system. Therefore, I have been experimenting with a liquid cooling solution that works for this scenario. I&#8217;m sharing this information for those adventurous individuals who might encounter similar challenges, and perhaps this approach can inspire some creative solutions.</p>



<p>In the upcoming sections of this article, I will guide you on how to set up a liquid cooling system specifically tailored for the Ampere Altra on the ALTRAD8UD-1L2T motherboard. In theory, since the screw hole positions are the same, this method should be applicable to other Ampere motherboards as well. However, the focus of this content will primarily be on the ALTRAD8UD-1L2T. The article will also cover any pitfalls encountered during assembly and the items needed for the setup(Chinese website).</p>



<h2 class="wp-block-heading">Preparation</h2>



<h3 class="wp-block-heading">ALTRAD8UD-1L2T</h3>



<p><br />You can find the specifications for this motherboard online, and I won&#8217;t repeat them here. However, what might confuse some people is the term &#8220;Deep mATX.&#8221; This is a specification unique to AsRock, where they increase the depth dimension of the mATX form factor while maintaining the standard width. The purpose is to provide more space to accommodate additional components. This particular specification is commonly seen in AsRock&#8217;s server-grade motherboards.</p>



<h3 class="wp-block-heading">Chassis</h3>



<p>Generally, most computer cases should work. However, I made a mistake on my end by choosing a case that was too small. The case I purchased is the Antec P110 Silent. While it has liquid cooling mounting points, it is not suitable for adding a liquid cooling system. The internal space is too limited, lacking a designated area for securing the water pump. Additionally, the Antec P110 liquid cooling radiator cannot be placed at the top as it interferes with the motherboard. Consequently, the radiator had to be positioned at the front of the case.</p>



<p>When making a purchase, it&#8217;s crucial to choose a case that is suitable for water cooling. In more extreme cases, considering a caseless system might be an option (hopefully, this can be updated in the next release).</p>



<p>Cases designed for liquid cooling systems typically have more significant internal space to accommodate a water pump, and there is ample room for fans without obstruction. Some all-in-one water cooling designs may be more compact and might not encounter this issue.</p>



<h3 class="wp-block-heading">Liquid Cooling System</h3>



<p><br />Liquid cooling systems have some considerations to take into account:</p>



<ul class="wp-block-list">
<li>Tubing type: Choose between soft or hard tubing. Hard tubing is suitable for experienced users, offering a longer lifespan and a more aesthetic appearance. Soft tubing is easier for assembly, making it suitable for beginners.</li>



<li>All-in-one (AIO) or custom loop: Decide whether to go for a pre-assembled AIO liquid cooling system or build a custom loop system.</li>
</ul>



<p>Since the initial focus was on researching liquid cooling, the combination chosen was a custom loop with soft tubing. Building a custom loop may encounter some issues, with one of the main challenges being the uncertainty about specifications.</p>



<p>The first crucial aspect is determining the size of the liquid cooling tubing, as additional components will depend on this size, limiting the options for procurement. Currently, the mainstream sizes are two-eighths (2/8’), three-eighths (3/8’), and four-eighths (4/8’) liquid cooling tubing. </p>



<p>Another parameter is the thickness of the tubing, thick tubing and thin tubing. <br />* thick tubing refer to 10/16mm or 3/8”-5/8” tubing. <br />* thin thbing refer to 10/13mm or 3/8”-1/2″ tubing. </p>



<p>Most common  the inner diameter specification is G 1/4, when find some liquid colling componens like pressure relief valve needs it. </p>



<p>Once you&#8217;ve confirmed your inner and outer diameter, you can proceed to purchase the necessary liquid cooling components.</p>



<p>At a minimum, you&#8217;ll need:</p>



<ul class="wp-block-list">
<li>CPU water block *1</li>



<li>Water Pump *1</li>



<li>240mm radiator *1</li>



<li>12cm fans *2</li>



<li>Liquid coolant 500cc ~ 1000cc</li>



<li>Tubing 2M</li>



<li>Thermal paste</li>



<li>Pressure relief valve</li>



<li>Fittings: Quick connectors *6, 90-degree rotary fittings *(1~2)</li>



<li>Tools for filling and draining: Filling tool, draining tool (watering can, large syringe, drainage hose)</li>
</ul>



<p>Optional components:</p>



<ul class="wp-block-list">
<li>Flow meter, temperature gauge (note: buying these requires purchasing two additional quick connectors).</li>
</ul>



<p></p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="846" height="863" src="https://richliu.com/wp-content/uploads/2024/01/image-9.png" alt="" class="wp-image-5448" style="aspect-ratio:0.9803012746234068;width:541px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-9.png 846w, https://richliu.com/wp-content/uploads/2024/01/image-9-588x600.png 588w, https://richliu.com/wp-content/uploads/2024/01/image-9-768x783.png 768w" sizes="auto, (max-width: 846px) 100vw, 846px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="651" height="637" src="https://richliu.com/wp-content/uploads/2024/01/image-10.png" alt="" class="wp-image-5449" srcset="https://richliu.com/wp-content/uploads/2024/01/image-10.png 651w, https://richliu.com/wp-content/uploads/2024/01/image-10-600x587.png 600w" sizes="auto, (max-width: 651px) 100vw, 651px" /></figure>



<p><br />In practical testing, if focusing solely on CPU cooling, it appears that a 240mm radiator is sufficient. The thin three-eighths (3/8”) tubing provides a large enough water flow diameter. Choosing a smaller tube diameter may not be as suitable for this purpose.</p>



<h3 class="wp-block-heading">CPU water block</h3>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="514" height="512" src="https://richliu.com/wp-content/uploads/2024/01/image-11.png" alt="" class="wp-image-5450" style="aspect-ratio:1.00390625;width:263px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-11.png 514w, https://richliu.com/wp-content/uploads/2024/01/image-11-300x300.png 300w" sizes="auto, (max-width: 514px) 100vw, 514px" /></figure>
</div>


<p>This turned out to be quite troublesome. My original plan was to purchase a 50mmx50mm heatsink and connect it to the heatsink on the right. Then, I intended to secure it to the CPU socket using the fixtures shown in the image. However, as expected, unexpected issues arose – the world isn&#8217;t always that kind.</p>



<ol class="wp-block-list">
<li>There was no water block with a 50mmx50mm connector available. So, I ended up buying a 40mmx40mm connector, one size smaller. This resulted in poorer heat dissipation performance. Fortunately, I never had the chance to test the inferior heat dissipation, so this step failed unnoticed.</li>



<li>Here&#8217;s where I made a mistake. Custom water block connectors, like the one shown, are typically 2/8&#8243; fittings. However, the main liquid cooling system I bought has 3/8&#8243; fittings, making them completely incompatible. The options were either to change the fittings or change the entire system. Changing the fittings was the more cost-effective choice, so I opted for that.</li>
</ol>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="787" height="1050" src="https://richliu.com/wp-content/uploads/2024/01/image-12.png" alt="" class="wp-image-5451" style="aspect-ratio:0.7495238095238095;width:237px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-12.png 787w, https://richliu.com/wp-content/uploads/2024/01/image-12-450x600.png 450w, https://richliu.com/wp-content/uploads/2024/01/image-12-768x1025.png 768w" sizes="auto, (max-width: 787px) 100vw, 787px" /></figure>
</div>


<p>After connecting , it looked like the image on the right – and just looking at it made me worry that water would leak out.</p>



<p>So, I bought a two-eighths(2/8&#8243;) tubing to connect to this connector. However, while it could connect, it couldn&#8217;t link up with my three-eighths(3/8&#8243;) tubing in the water cooling system. I had to reluctantly abandon the custom water block connector.</p>



<p>The final solution had nothing to do with this connector.</p>



<p></p>



<p></p>



<h3 class="wp-block-heading">Communical CPU water block</h3>



<p>During the installation, I discovered that the Bykski CPU-XPH-T8 CPU water block, along with the provided adapter bracket, could be securely attached to the Ampere Altra&#8217;s socket. This was fantastic news and saved me a great deal of effort.</p>



<p>Although it&#8217;s designed for Intel LGA1700/LGA2066 sockets, the flexibility in its hole configuration allowed for adjustments, providing me with the necessary adaptability. As for whether other CPU brackets might be compatible, it&#8217;s likely that some could work. However, I haven&#8217;t had the chance to try others yet. If you have attempted this and found success, please let me know.</p>



<p>The base of this water block is quite substantial, and my intuition tells me that the cooling performance should be excellent. Therefore, I didn&#8217;t explore other compliant CPU water blocks.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="1109" height="976" src="https://richliu.com/wp-content/uploads/2024/01/image-16.png" alt="" class="wp-image-5455" style="aspect-ratio:1.1362704918032787;width:364px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-16.png 1109w, https://richliu.com/wp-content/uploads/2024/01/image-16-600x528.png 600w, https://richliu.com/wp-content/uploads/2024/01/image-16-768x676.png 768w" sizes="auto, (max-width: 1109px) 100vw, 1109px" /></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1196" height="722" src="https://richliu.com/wp-content/uploads/2024/01/image-14.png" alt="" class="wp-image-5453" srcset="https://richliu.com/wp-content/uploads/2024/01/image-14.png 1196w, https://richliu.com/wp-content/uploads/2024/01/image-14-600x362.png 600w, https://richliu.com/wp-content/uploads/2024/01/image-14-768x464.png 768w" sizes="auto, (max-width: 1196px) 100vw, 1196px" /></figure>
</div>
</div>



<p><br />However, another issue arises. The water block is 56mmx56mm, whereas the width of the Ampere Altra CPU socket is 55mm. The water block does not fit. At this point, there are two possible solutions:</p>



<p>Upon observing the CPU&#8217;s structure, the first solution seemed unfeasible. Cutting down the thickness of this water block would compromise its structural integrity, not to mention finding the tools or a professional service for the task.</p>



<p>Thus, the only viable option is the second solution. The simplest and most intuitive way to implement this is by using a thermal pad made of silicone to transfer heat upwards from the CPU.</p>



<h3 class="wp-block-heading">Silicone Thermal Pad </h3>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1286" height="707" src="https://richliu.com/wp-content/uploads/2024/01/image-17.png" alt="" class="wp-image-5456" style="aspect-ratio:1.818953323903819;width:322px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-17.png 1286w, https://richliu.com/wp-content/uploads/2024/01/image-17-600x330.png 600w, https://richliu.com/wp-content/uploads/2024/01/image-17-768x422.png 768w" sizes="auto, (max-width: 1286px) 100vw, 1286px" /></figure>
</div>


<p>But things couldn&#8217;t be as simple as I, a fool, initially thought. In conclusion, regular silicone thermal pads are not suitable for power monsters like the Ampere Altra. This type of thermal pad may be effective for low-power devices such as routers, switches, NVMe disks, etc., but it&#8217;s not useful for high-power CPUs.</p>



<p>In the image, there are 2mm thick silicone thermal pads, and you need two layers because the height is just that much. Essentially, this provides only a slight improvement over having no heat dissipation at all, so it&#8217;s not worth considering.</p>



<p>As for the high-efficiency silicone thermal pads available in the market, I don&#8217;t know if they would work. If you have them on hand, you can give them a try. However, I believe the chances of success are quite low.</p>



<h3 class="wp-block-heading"><br />Purple Copper Thermal Pad</h3>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1468" height="833" src="https://richliu.com/wp-content/uploads/2024/01/image-18.png" alt="" class="wp-image-5457" style="aspect-ratio:1.7623049219687874;width:317px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-18.png 1468w, https://richliu.com/wp-content/uploads/2024/01/image-18-600x340.png 600w, https://richliu.com/wp-content/uploads/2024/01/image-18-768x436.png 768w" sizes="auto, (max-width: 1468px) 100vw, 1468px" /></figure>
</div>


<p><br />Nowadays, a common method for cooling is using purple copper heat pipes. This type of heat dissipation is quite effective, and the 2U passive heatsink included with Newegg utilizes these heat pipes. Therefore, if we can customize the heatsink, wouldn&#8217;t that solve the problem? Luckily, the country right next to my country is the world&#8217;s largest manufacturing factory, capable of customizing just about anything. This made the solution very affordable and instantly resolved my problem.</p>



<p>The dimensions of the purple copper thermal pad are: Length x Width x Height = 64x54x4mm, with a rounded R5 edge.</p>



<p>Alternatively, you can measure the dimensions of the piece under the 2U passive heatsink to get the specifications. Placing it on the original heatsink, I can say the dimensions match perfectly. The craftsmanship is quite impressive, and there are no issues when it&#8217;s actually placed.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-scaled.jpg" alt="" class="wp-image-5458" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<h2 class="wp-block-heading">Assembly</h2>



<p><br />First, place the purple copper thermal pad, and remember to apply thermal paste before doing so.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-scaled.jpg" alt="" class="wp-image-5459" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p>Apply thermal paste before placing CPU water cooling block. </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-scaled.jpg" alt="" class="wp-image-5460" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p><br />Assemble the components.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-scaled.jpg" alt="" class="wp-image-5461" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p>Actually, I assembled the tubing on the left side incorrectly. I&#8217;ll need to purchase materials and quick connectors to replace it when I have the time. But for now, let&#8217;s leave it as is and make do.</p>



<p>Overall view.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg" alt="" class="wp-image-5462" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p> <br />This way, it&#8217;s evident that the case isn&#8217;t ideal. It&#8217;s too cramped, affecting airflow, and it cannot accommodate the components properly.</p>



<h2 class="wp-block-heading">Shopping</h2>



<p>If you are interested in replicating my setup, all the components were purchased from Taobao. I spent extra for testing and experimenting, but in reality, you should be able to set up the entire cooling system for around US$100 or NTD$3,000. This is comparable to the cost of an efficient dual-fan tower cooler.</p>



<p>Since this is a Chinese website, I&#8217;ll keep the text in Chinese and provide English translations afterward.</p>



<h3 class="wp-block-heading">Liquid Cooling System</h3>



<p><a href="https://item.taobao.com/item.htm?spm=a1z09.2.0.0.17af2e8dIZLPG3&amp;id=689355457926&amp;_u=81mce81r4a19" target="_blank" rel="noopener">watertiger定制台式机电脑分体式CPU显卡水冷软管套装冷散热器</a> (&#8220;WaterTiger Custom Desktop Computer Split-Type CPU GPU Liquid Cooling Soft Tube Kit Radiator&#8221;)<br />Enter the URL choice &#8220;單 CPU 水冷 240 冷排&#8221; (&#8220;Single CPU Liquid Cooling 240 Radiator&#8221;)</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1146" height="780" src="https://richliu.com/wp-content/uploads/2024/01/image-19.png" alt="" class="wp-image-5463" srcset="https://richliu.com/wp-content/uploads/2024/01/image-19.png 1146w, https://richliu.com/wp-content/uploads/2024/01/image-19-600x408.png 600w, https://richliu.com/wp-content/uploads/2024/01/image-19-768x523.png 768w" sizes="auto, (max-width: 1146px) 100vw, 1146px" /></figure>



<p>At first, I chose this brand because the photos looked appealing, but it turned out to be a fortunate coincidence that saved me a lot of exploration time. This brand integrates various components into a set for sale, and the components they use are of decent quality. For example, they use the Enermax NEOChanger as the water pump, which is also a good pump. If you are familiar enough, you might not need these kits.</p>



<p>This kit does not include a pressure relief valve. You&#8217;ll need to purchase a pressure relief valve separately, and depending on your needs, you might want to buy additional quick connectors</p>



<h3 class="wp-block-heading">Clamping Fittings</h3>



<p>All the components can be purchased from the same place, saving the hassle of searching everywhere. It&#8217;s a good idea to buy a few extra parts to avoid trouble later on. The time cost is much higher than the cost of the components.</p>



<p><a href="https://item.taobao.com/item.htm?_u=81mce81r8034&amp;id=38513060164&amp;spm=a1z09.2.0.0.17af2e8dIZLPG3" target="_blank" rel="noopener">电脑水冷头扣具卡具CPU显卡南北桥固定笔记本散热器压条五金夹具</a> (&#8220;Computer Water Cooling Head Fastening Fixture, CPU GPU North-South Bridge Fixing, Laptop Heatsink Clamp, Hardware Clamp&#8221;)</p>



<p>Choice 台式机CPU冷头扣具(&#8220;Desktop CPU Cooling Head Fastening Fixture&#8221;) *2 </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="543" height="358" src="https://richliu.com/wp-content/uploads/2024/01/image-20.png" alt="" class="wp-image-5464"/></figure>



<p><br /><a href="https://item.taobao.com/item.htm?_u=81mce81rb354&amp;id=39519155251&amp;spm=a1z09.2.0.0.17af2e8dIZLPG3" target="_blank" rel="noopener">M2 M3 M4不锈钢平头盘头螺丝钉水冷头水冷排机箱风扇安装长螺丝</a> (&#8220;M2 M3 M4 Stainless Steel Flat Head Countersunk Screws for Water Cooling Head, Radiator, Case Fan Installation &#8211; Long Screws&#8221;)</p>



<p>Fastening fixtures for securing CPU coolers and water blocks. The components can be increased based on requirements. The minimum required quantity includes<br />M3手拧螺母 (M3 thumb nuts)*4，M3*30 (M3 screws) *4 ，M3垫片(M3 washers) *4  ，M3六角螺母(M3 hex nuts) *4<br /></p>



<p><a href="https://item.taobao.com/item.htm?spm=a1z09.2.0.0.17af2e8dIZLPG3&amp;id=538187007087&amp;_u=81mce81r8677" target="_blank" rel="noopener">电脑水冷水流计 液冷散热器流量器 流体温度观测器透明水流指示计</a> (&#8220;Computer Liquid Cooling Flow Meter, Liquid Cooler Flow Indicator, Fluid Temperature Monitor Transparent Flow Meter&#8221;) (option)</p>



<p>Choice: 3孔水流观测器 + 温度计 (&#8220;3-Port Flow Meter + Thermometer for Water Flow Observation&#8221;)</p>



<p>Nice to have items, but it can make me feel better. </p>



<h2 class="wp-block-heading">Test Result</h2>



<p>This system feels relatively quiet and not noisy.</p>



<p>The following tests are only for verifying the liquid cooling setup and are not formal performance tests. The results are provided for liquid cooling reference and do not include testing power consumption, etc.</p>



<p>Room temperature: 25 degrees Celsius<br />CPU : Ampere AltraMax 128-30<br />Run command :  stress-ng &#8211;cpu 128 &#8211;iomix 128 &#8211;vm 128</p>



<p>Gentoo Linux kernel 6.6 ，CPU temperature is approximately，Power consumption CPU 150W/ IO 19W<br />Ubuntu 22.04 kernel 6.2(?)，CPU temperature is approximately 72 degrees，Power consumption CPU 178W/ IO 20W</p>



<p>In conclusion, I hope this article has been helpful for those eager to try it out.</p>



<h2 class="wp-block-heading">Afterword</h2>



<p>Newegg has also listed another model, which is only the motherboard version, only US$849.-<br /><a href="https://www.newegg.com/p/N82E16813140130" target="_blank" rel="noopener">ASRock Rack ALTRAD8UD-1L2T Deep Micro-ATX Server Motherboard Singel Socket (LGA 4926) Ampere Altra Max/Ampere Altra processors Dual 10G &amp; 1G</a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/">Ampere Altra/AltraMax AsRock ALTRAD8UD-1L2T Liquid Cooling System</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ampere Altra/AltraMax 加AsRock ALTRAD8UD-1L2T 水冷方案</title>
		<link>https://richliu.com/2024/01/09/5446/ampere-altra-altramax-%e5%8a%a0asrock-altrad8ud-1l2t-%e6%b0%b4%e5%86%b7%e6%96%b9%e6%a1%88/</link>
					<comments>https://richliu.com/2024/01/09/5446/ampere-altra-altramax-%e5%8a%a0asrock-altrad8ud-1l2t-%e6%b0%b4%e5%86%b7%e6%96%b9%e6%a1%88/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Mon, 08 Jan 2024 17:19:12 +0000</pubDate>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Altra]]></category>
		<category><![CDATA[AltraMax]]></category>
		<category><![CDATA[Ampere]]></category>
		<category><![CDATA[水冷]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5446</guid>

					<description><![CDATA[<p>English version article is here (Ampere Altra/AltraMax  [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/01/09/5446/ampere-altra-altramax-%e5%8a%a0asrock-altrad8ud-1l2t-%e6%b0%b4%e5%86%b7%e6%96%b9%e6%a1%88/">Ampere Altra/AltraMax 加AsRock ALTRAD8UD-1L2T 水冷方案</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg" alt="" class="wp-image-5462" style="aspect-ratio:1.3333333333333333;width:224px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>
</div>


<p>English version article is <a href="https://richliu.com/2024/01/09/5471/ampere-altra-altramax-asrock-altrad8ud-1l2t-liquid-cooling-system/">here (Ampere Altra/AltraMax AsRock ALTRAD8UD-1L2T Liquid Cooling System)</a><br />2024/01<a href="https://www.servethehome.com/making-arm-desktops-viable-ampere-altra-noctua-nh-d9-amp-4926-4u-and-nh-u14s-amp-4926/" target="_blank" rel="noopener">/31 Update: Ampere will have 2U passive cooler Making Arm Desktops Viable Ampere Altra Noctua NH-D9 AMP-4926 4U and NH-U14S AMP-4926</a></p>



<p>Ampere Altra/AltraMax CPU 最高單顆 CPU 是 128 核 ARM64 的 CPU，一般都是在伺服器主機上，但是伺服器主機非常不適合放在公司內或是家用，因為一般伺服器主機都會用高轉速風扇散熱，一般人是不能忍受這樣的噪音。伺服器主機板也不方便改裝到一般家用主機板，如果真的想要用，<a href="https://www.adlinktech.com/products/Computer_on_Modules/COM-HPC-Server-Carrier-and-Starter-Kit/Ampere_Altra_Developer_Platform?lang=en" target="_blank" rel="noopener">ADLink Ampere Altra Dev Platform</a> 是一個不錯的解決方案，也有水冷的選項。<br />另一個解決方案就是 <a href="https://www.newegg.com/p/N82E16813140134" target="_blank" rel="noopener">AsRock ALTRAD8UD-1L2T</a> ，目前在 <a href="https://www.newegg.com/p/N82E16813140134" target="_blank" rel="noopener">newegg </a>上架了，配合一個 Ampere Altra Q64-22 (64 cores 2.2G) 的 CPU，附贈一個 2U Passive 的散熱片，價格 US$1,500.- ，應該算便宜。但是送的是被動散熱，如果不想要裝一顆風扇到被動散熱上，想要改成水冷散熱，那看我這篇文章就對了。</p>



<span id="more-5446"></span>



<p>本人習慣，在有可能造成危險的文章，會在文章前面加上宣言<br />* 本篇文章並非 Ampere,  Newegg 或是其他任何文章內提到的商城及店家業配文，純屬個人紀錄<br />* 本文作者和部份這塊板子的生產有利益關係，特此揭示<br />* 作者是第一次接觸電腦系統水冷，內容可能不盡正確，請自行注意風險<br />* 本文並非 Ampere 或是 AsRock 官方文件<br />* <mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color">本人不對本篇文章的造成的任何影響負責任；例如看本人文章操作不當造成的損失等等</mark></p>



<p>Ampere 系統主要是專攻 Cloud nativate CPU，所以直至目前為止，並沒有廠商生產一般用途的散熱系統。這個系統附贈的 2U Passive 散熱片是 Server 專用的，使用的是 Server 高速風扇散熱；雖然 newegg 附的是 Q64-22 ，功耗比較低，但是唯一的散熱方式就是拿電風扇直接吹，要不然就是卡一個8吋風扇在上面，這種散熱方案像我這樣的專業玩家是無法接受的</p>



<p>如果要進階散熱，一般的塔型散熱系統需要將主機板背面的夾具換掉，而且也要能跟這個板子的扣具相容，找到相容的塔型散熱難度可能也不小。考量到只能在正面鎖螺絲，那唯一能用的散熱系統就是水冷式散熱。所以我這段時間摸索出了一條可以用的水冷散熱解決方案，在此分享給想要踩雷的朋友們，或許這個做法也可以激發各位的創意。</p>



<p>接下來會在這篇文章內介紹要如何在 ALTRAD8UD-1L2T 板子上，搭建屬於 Ampere Altra 的水冷系統，理論上因為螺絲孔位一樣，所以 Ampere 其他的板子也可以用，但是本篇內容主要以 ALTRAD8UD-1L2T 為主，而本文亦會提到踩過的地雷或是採購項目。</p>



<h2 class="wp-block-heading">準備</h2>



<h3 class="wp-block-heading">ALTRAD8UD-1L2T</h3>



<p>上網可以找到這塊板子的規格，這些就不再重覆，但是一般人會比較迷惑的是，什麼是 Deep mATX ？<br />這個是 AsRock 自己的規格，是增加 mATX 的深度尺寸，保持 mATX 的寬度規格，以增加更多空間容納更多元件。這個特別的規格常見於 AsRock server grade 的主機板上。</p>



<h3 class="wp-block-heading">機殼</h3>



<p>一般機殼應該都可以。不過我這邊犯了一個錯誤，機殼買太小，我買的機殼是 Antec P110 Silent ，雖然有水冷孔位，但是這個機殼不適合加裝水冷，內部空間太小，沒有固定水泵的地方，Antec P110 水冷排無法放在上方，會卡到主機板，所以最後水冷排是放機殼前方</p>



<p>採購時，請找適合水冷的機殼，更極端一點可以考慮無機殼系統（希望下次更新可以更新無機殼系統）。</p>



<p>水冷機殼內部空間需求更大，要有地方放水泵，還有風扇放下去不會卡住。<br />有些一體式水冷的設計會比較小，比較不會有這個問題</p>



<h3 class="wp-block-heading">水冷設備</h3>



<p>水冷散熱有一些需要考慮的<br />* 軟管或是硬管（硬管比較適合有經驗的，壽命長，較美觀；軟體組裝方便，適合新手）<br />* 一體式水冷（廠商已經組裝好）或是分體式水冷（自組水冷系統）</p>



<p>因為一開始是研究如何建置水冷，所以一定是分體式水冷加軟管的組合。自組水水冷又會碰到一些問題，最主要的是不知道規格為何？<br />第一件需要確定的是水冷管大小，因為加購設備就是看水冷管大小，這會限制採購品項<br />目前主流有 二分(2/8’)、三分(3/8’)、四分(4/8’)水冷管，但是實際上在找產品的時候，會標為像 6*10(二分) 9.5*12.7(三分，有些會標 10*13) 另外還有 8*12 不知道對應到什麼，數字小的是內徑，數字大的是外徑 。三分又有分三分薄和三分厚，三分薄就是 10/13 ，三分厚就是 10/16 ，如果不是老手很容易在這邊搞錯。本文用的全部都是三分薄的系統</p>



<p>以上有英制和公制，要特別小心注意規格，像洩氣閥內徑規格就要用 G 1/4 規格的（目前大都是此規格）<br />確定好自己的內外徑之後，就可以採購需要的水冷套件</p>



<p>最少需要的是<br />CPU水冷頭*1<br />水泵*1<br />240寬冷排*1 <br />12CM風扇*2<br />水冷液 500cc ~ 1000cc<br />水管 2M<br />散熱膏<br />洩壓閥<br />接頭：快速接頭*6 ，90度旋轉彎頭*(1~2個)<br />注水工具，放水工具（加水壺，大針筒，放水管）<br />可選：<br />流量計，水溫計（註：買這個要多買二個快速接頭）</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="846" height="863" src="https://richliu.com/wp-content/uploads/2024/01/image-9.png" alt="" class="wp-image-5448" style="aspect-ratio:0.9803012746234068;width:541px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-9.png 846w, https://richliu.com/wp-content/uploads/2024/01/image-9-588x600.png 588w, https://richliu.com/wp-content/uploads/2024/01/image-9-768x783.png 768w" sizes="auto, (max-width: 846px) 100vw, 846px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="651" height="637" src="https://richliu.com/wp-content/uploads/2024/01/image-10.png" alt="" class="wp-image-5449" srcset="https://richliu.com/wp-content/uploads/2024/01/image-10.png 651w, https://richliu.com/wp-content/uploads/2024/01/image-10-600x587.png 600w" sizes="auto, (max-width: 651px) 100vw, 651px" /></figure>



<p>實測如果只針對 CPU 散熱，目前看起來 240 水冷排就夠，而三分薄提供了夠大的水流口徑。<br />如果管徑再小可以不太合適。</p>



<h3 class="wp-block-heading">CPU水冷散熱頭</h3>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="514" height="512" src="https://richliu.com/wp-content/uploads/2024/01/image-11.png" alt="" class="wp-image-5450" style="aspect-ratio:1.00390625;width:263px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-11.png 514w, https://richliu.com/wp-content/uploads/2024/01/image-11-300x300.png 300w" sizes="auto, (max-width: 514px) 100vw, 514px" /></figure>
</div>


<p>這個頗麻煩的，我原來的規劃是買一個 50mmx50mm 的散熱片接到像右邊的散熱頭上。然後用圖中的夾具固定在 CPU 座上面，但是不出意外的就出了意外，這世界上沒這麼好的事情</p>



<p>1 ) 沒有 50mmx50mm 的水冷頭接頭，所以買的是 40mmx40mm 的接頭，小了一圈，散熱性能較差，幸運的是我根本沒機會測到散熱性能較差這步就失敗了</p>



<p>2) 我在這邊犯了一個錯誤，這種像是定製的水冷接頭都是 2/8&#8243; 頭，但是我買的主要水冷系統是 3/8&#8243; 的系統，完全接不上去，要就是要換頭，或是換系統；當然換頭比較便宜，所以選擇換頭</p>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="787" height="1050" src="https://richliu.com/wp-content/uploads/2024/01/image-12.png" alt="" class="wp-image-5451" style="aspect-ratio:0.7495238095238095;width:237px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-12.png 787w, https://richliu.com/wp-content/uploads/2024/01/image-12-450x600.png 450w, https://richliu.com/wp-content/uploads/2024/01/image-12-768x1025.png 768w" sizes="auto, (max-width: 787px) 100vw, 787px" /></figure>
</div>


<p>接上去之後像是右邊這樣，這光看都覺得水會跑出來吧</p>



<p>所以我買了二分管想要接這個接頭，但是二分管是可以接上去沒錯，但是接不上我水冷的三分管系統。只能果斷放棄接定製水冷頭</p>



<p>最後的解法已經和這個接頭無關了</p>



<p></p>



<p></p>



<h3 class="wp-block-heading">商用水冷頭</h3>



<p>在裝的時候發現買的套件附的 Bykski CPU-XPH-T8 這顆 CPU 水冷頭加轉接夾具可以合上到 Ampere Altra 的底座，這簡直太棒了啊。省了非常多功夫</p>



<p>雖然是給 Intel LGA1700/LGA2066用的，所以它的孔位設計成非常彈性，這就給了我調整的空間。至於其他 CPU 的夾具有沒有可能可以用，應該也有可以用的，不過這邊我還沒機會試，如果你有試過可以告訴我。<br />而這個水冷頭的底座非常大，直覺告訴我散熱效果應該非常好，所以也並未去找其他合規的 CPU 水冷頭</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="1109" height="976" src="https://richliu.com/wp-content/uploads/2024/01/image-16.png" alt="" class="wp-image-5455" style="aspect-ratio:1.1362704918032787;width:364px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-16.png 1109w, https://richliu.com/wp-content/uploads/2024/01/image-16-600x528.png 600w, https://richliu.com/wp-content/uploads/2024/01/image-16-768x676.png 768w" sizes="auto, (max-width: 1109px) 100vw, 1109px" /></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1196" height="722" src="https://richliu.com/wp-content/uploads/2024/01/image-14.png" alt="" class="wp-image-5453" srcset="https://richliu.com/wp-content/uploads/2024/01/image-14.png 1196w, https://richliu.com/wp-content/uploads/2024/01/image-14-600x362.png 600w, https://richliu.com/wp-content/uploads/2024/01/image-14-768x464.png 768w" sizes="auto, (max-width: 1196px) 100vw, 1196px" /></figure>
</div>
</div>



<p>但是接下來又有另一個問題，這個水冷頭是 56mmx56mm ，而 Ampere Altra CPU socket 寬度為 55mm，這個水冷頭放不下。這時有二個選擇方案<br />1) 切割水冷頭讓它變小（還沒考慮高度問題）<br />2) 將熱從 CPU 接到水冷頭</p>



<p>第一個方案觀察了一下 CPU 工藝，覺得不可行，因為這顆水冷頭的厚度切下去會影響結構，更別提還要想辦法找到工具或是店家切割。</p>



<p>那就只能用第二個方案了，這個方案最簡單並且非常直覺的方式就是用矽膠導熱墊將熱拉上來</p>



<h3 class="wp-block-heading">矽膠導熱墊 (thermal pad silicone)</h3>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1286" height="707" src="https://richliu.com/wp-content/uploads/2024/01/image-17.png" alt="" class="wp-image-5456" style="aspect-ratio:1.818953323903819;width:322px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-17.png 1286w, https://richliu.com/wp-content/uploads/2024/01/image-17-600x330.png 600w, https://richliu.com/wp-content/uploads/2024/01/image-17-768x422.png 768w" sizes="auto, (max-width: 1286px) 100vw, 1286px" /></figure>
</div>


<p>但是事情怎麼會像我這個笨蛋想的這麼簡單，先說結論，一般的矽膠導熱墊不適用於 Ampere Altra 這種 Power Monster ，所以完全不用考慮。這種矽膠導熱墊給小功率的 router/switch/nvme disk 等等或許有用，對大功率的 CPU 是沒有用的</p>



<p>圖中是 2mm 厚的矽膠導熱墊，而且要二層，因為高度就是這麼高，基本上這個只比不接散熱好一點點而已，所以別想了</p>



<p>至於市面上賣的高效率矽膠導熱墊有沒有用我就不知道了，如果手上有現成的可以試試，不過我認為成功機率很低</p>



<h3 class="wp-block-heading">紫銅導熱片</h3>


<div class="wp-block-image">
<figure class="alignright size-full is-resized"><img loading="lazy" decoding="async" width="1468" height="833" src="https://richliu.com/wp-content/uploads/2024/01/image-18.png" alt="" class="wp-image-5457" style="aspect-ratio:1.7623049219687874;width:317px;height:auto" srcset="https://richliu.com/wp-content/uploads/2024/01/image-18.png 1468w, https://richliu.com/wp-content/uploads/2024/01/image-18-600x340.png 600w, https://richliu.com/wp-content/uploads/2024/01/image-18-768x436.png 768w" sizes="auto, (max-width: 1468px) 100vw, 1468px" /></figure>
</div>


<p>那現在一般的散熱是怎麼散熱呢？一般都是紫銅導熱管，這個散熱效率還不錯，newegg 附贈的 2U passive heatsink 就是使用這種導熱管散熱。所以如果可以客製散熱片，這樣不就解決問題了嗎？幸好我們旁邊就是世界最大的製造工廠，任何怪東西都可以客製，這樣一片非常便宜，瞬間解決了我的問題</p>



<p>紫銅導熱片的尺寸規格是<br />長x寬x高 = 64x54x4mm ，另外要倒 R5 的角</p>



<p>也可以量 2U passive heatsink 下面那一塊得到規格，放在原廠的散熱片上只能說尺寸一樣<br />工藝還真不錯，實際放下去也沒有問題</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-scaled.jpg" alt="" class="wp-image-5458" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240108_235640-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<h2 class="wp-block-heading">組合</h2>



<p>先放上紫銅導熱片，記得放之前塗散熱膏</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-scaled.jpg" alt="" class="wp-image-5459" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184648-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p>放上去之前再塗散熱膏</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-scaled.jpg" alt="" class="wp-image-5460" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184740-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p>合體</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-scaled.jpg" alt="" class="wp-image-5461" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20240105_184300-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p>其實這張圖左邊的管子我裝錯了，有空要再去買材料和快速接頭來換，但是現在就先這樣吧，撐一下。</p>



<p>全貌</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="2560" height="1920" src="https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg" alt="" class="wp-image-5462" srcset="https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-scaled.jpg 2560w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-600x450.jpg 600w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-768x576.jpg 768w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-1536x1152.jpg 1536w, https://richliu.com/wp-content/uploads/2024/01/IMG_20231212_001937-2048x1536.jpg 2048w" sizes="auto, (max-width: 2560px) 100vw, 2560px" /></figure>



<p> 這樣就看得出來這機殼不好了，太擠太小影響風流，不能放在上面</p>



<h2 class="wp-block-heading">購物</h2>



<p>如果你是想學我的方案，我所有的零件都是從 Taobao 購入，我因為有測試還有多花錢<br />但是實際上應該 US$100, NTD$3,000 左右可以搞定整個散熱系統。<br />跟一個效率好的雙風扇塔扇差不多</p>



<h3 class="wp-block-heading">水冷系統</h3>



<p><a href="https://item.taobao.com/item.htm?spm=a1z09.2.0.0.17af2e8dIZLPG3&amp;id=689355457926&amp;_u=81mce81r4a19" target="_blank" rel="noopener">watertiger定制台式机电脑分体式CPU显卡水冷软管套装冷散热器</a><br />進去後選單 CPU 水冷 240 冷排</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1146" height="780" src="https://richliu.com/wp-content/uploads/2024/01/image-19.png" alt="" class="wp-image-5463" srcset="https://richliu.com/wp-content/uploads/2024/01/image-19.png 1146w, https://richliu.com/wp-content/uploads/2024/01/image-19-600x408.png 600w, https://richliu.com/wp-content/uploads/2024/01/image-19-768x523.png 768w" sizes="auto, (max-width: 1146px) 100vw, 1146px" /></figure>



<p>當初是看照片比較好看所以買這家的，但是誤打誤撞節省我很多摸索的時間。<br />這家也是將各家設備整合弄一套出來賣，但是東西用的還不錯，像水泵用的是 Enermax NEOChanger ，也是還不錯的水泵。如果夠熟是可以不用這些套件。</p>



<p>這個套件沒有洩壓閥，另外要多採購洩壓閥，還有依需求可以多買快速接頭</p>



<h3 class="wp-block-heading">夾具</h3>



<p>以下都在同一家採購，不用到處找，零件可以多買一點，免得到時候要找麻煩，時間成本遠高於零件成本。</p>



<p><a href="https://item.taobao.com/item.htm?_u=81mce81r8034&amp;id=38513060164&amp;spm=a1z09.2.0.0.17af2e8dIZLPG3" target="_blank" rel="noopener">电脑水冷头扣具卡具CPU显卡南北桥固定笔记本散热器压条五金夹具</a></p>



<p>選台式机CPU冷头扣具 *2 </p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="543" height="358" src="https://richliu.com/wp-content/uploads/2024/01/image-20.png" alt="" class="wp-image-5464"/></figure>



<p><br /><a href="https://item.taobao.com/item.htm?_u=81mce81rb354&amp;id=39519155251&amp;spm=a1z09.2.0.0.17af2e8dIZLPG3" target="_blank" rel="noopener">M2 M3 M4不锈钢平头盘头螺丝钉水冷头水冷排机箱风扇安装长螺丝</a></p>



<p>固定 CPU 冷頭扣具和水冷頭的零件，這個可以依需求增加，以下是最低需求量<br />M3手拧螺母*4，M3*30 *4 ，M3垫片*4  ，M3六角螺母*4<br /></p>



<p><a href="https://item.taobao.com/item.htm?spm=a1z09.2.0.0.17af2e8dIZLPG3&amp;id=538187007087&amp;_u=81mce81r8677" target="_blank" rel="noopener">电脑水冷水流计 液冷散热器流量器 流体温度观测器透明水流指示计</a> (option)</p>



<p>選: 3孔水流观测器 + 温度计</p>



<p>可有可無的東西，不過有比較好玩</p>



<h2 class="wp-block-heading">測試結果</h2>



<p>這套系統個人感覺相對安靜，不會吵</p>



<p>以下測試只是驗證水冷測試，並非正式的 performance test ，結果僅供建置水冷參考，並非測試 power consumption等結果</p>



<p>室溫 25 度<br />CPU : Ampere AltraMax 128-30<br />Run command :  stress-ng &#8211;cpu 128 &#8211;iomix 128 &#8211;vm 128</p>



<p>Gentoo Linux kernel 6.6 ，CPU 溫度約在 67 度，Power consumption CPU 150W/ IO 19W<br />Ubuntu 22.04 kernel 6.2(?)，CPU 溫度約在 72 度，Power consumption CPU 178W/ IO 20W</p>



<p>最後希望這篇文章有幫到躍躍欲試的你</p>



<h2 class="wp-block-heading">後記</h2>



<p>Newegg 還有上架另一個型號，只有主機板的版本，只賣US$849.-<br /><a href="https://www.newegg.com/p/N82E16813140130" target="_blank" rel="noopener">ASRock Rack ALTRAD8UD-1L2T Deep Micro-ATX Server Motherboard Singel Socket (LGA 4926) Ampere Altra Max/Ampere Altra processors Dual 10G &amp; 1G</a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/01/09/5446/ampere-altra-altramax-%e5%8a%a0asrock-altrad8ud-1l2t-%e6%b0%b4%e5%86%b7%e6%96%b9%e6%a1%88/">Ampere Altra/AltraMax 加AsRock ALTRAD8UD-1L2T 水冷方案</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/01/09/5446/ampere-altra-altramax-%e5%8a%a0asrock-altrad8ud-1l2t-%e6%b0%b4%e5%86%b7%e6%96%b9%e6%a1%88/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
