유휴 상태에서 Folding@Home을 실행하는 방법은 무엇입니까?

유휴 상태에서 Folding@Home을 실행하는 방법은 무엇입니까?

Folding@Home을 설치하고 구성했습니다.

$ lsb_release --all
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 19.10
Release:    19.10
Codename:   eoan
$ FAHClient --version
7.5.1
$ cat /etc/fahclient/config.xml 
<config>
  <!-- Network -->
  <proxy v=':8080'/>

  <!-- Slot Control -->
  <idle v='true'/>
  <power v='FULL'/>

  <!-- User Information -->
  <team v='[omitted]'/>
  <user v='[omitted]'/>

  <!-- Folding Slots -->
  <slot id='0' type='CPU'/>
  <slot id='1' type='GPU'/>
</config>

그러나 서비스를 시작한 후에는 처리가 시작되지 않습니다. 내가 전환하면고객 idle설정바로 처리가 시작되었는데, 설정을 중간으로 낮춰도 power다른 작업은 거의 불가능했습니다.Folding@Home이 기계가 유휴 상태일 때만 작동하도록 하려면 어떻게 해야 합니까?즉, 사람의 개입 없이 몇 분 동안 유휴 시간이 지나면 처리를 시작하고 더 이상 유휴 상태가 아닌 즉시 처리를 중지해야 합니다.

답변1

나는 똑같은 문제가 있습니다. 클라이언트는 내 컴퓨터가 유휴 상태라고 결코 생각하지 않습니다. 결국 화면이 잠겨 있을 때만 FAH를 복원하는 스크립트를 만들었습니다. 효과는 매우 좋습니다. 여기서 확인할 수 있습니다:

https://github.com/Madoshakalaka/gnome-folding-at-screenlock

저장소가 다운되었을 때 저장소가 제대로 작동하도록 만드는 전체 단계는 다음과 같습니다.

  1. 이 서비스 파일을 다음 위치에 복사하세요./home/YOUR_DESTOP_USER/.config/systemd/user/gnome-folding-at-screenlock.service
[Unit]
Description=FAH controller based on screen locking/unlocking signals

[Service]
ExecStart=/usr/bin/gnome-folding-at-screenlock.sh

[Install]
WantedBy=default.target
  1. 이 쉘 스크립트를 귀하의 스크립트에 복사 /usr/bin/gnome-folding-at-screenlock.sh하고 실행 권한을 부여하십시오 sudo chmod +x /usr/bin/gnome-folding-at-screenlock.sh.
#!/usr/bin/env sh

dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" |
# Somehow I receive duplicate signals during locking and unlocking.
# It's a weird behavior but does no harm in our case.
  while read x; do
    case "$x" in
    "boolean true")
      echo "screen turns locked. Initiate folding" && FAHClient --send-unpause ;;
    "boolean false") echo "screen turns unlocked. Unfold! Unfold!" && FAHClient --send-pause ;;
    *) ;;
    esac
  done
  1. sudo systemctl enable foldingathome && sudo systemctl start foldingathome아직 그렇게 하지 않았다면. 스크립트는 foldingathome서비스를 시작하거나 중지하지 않습니다. 서비스가 시작되고 일시중지/일시중지 해제를 통해 축소된다고 가정합니다 FAHClient. 일시중지 또는 일시중지 해제는 위치한 프로필에 남아 있습니다 /etc/foldingathome/config.xml.
  2. 브라우저의 대시보드로 이동하여 http://localhost:7396/일부 옵션을 변경하세요. 더 이상 FAH의 유휴 감지에 의존하지 않으므로 "작업하는 동안" 옵션을 선택해야 합니다. 또한 이상적인 전력 수준을 설정할 수 있습니다. 마지막으로 "접기 중지" 버튼을 클릭하여 접기를 중지합니다. 그러면 실제로 <paused v='true'>프로필에 라벨이 추가됩니다(디스플레이를 깨울 때 스크립트가 수행하는 작업과 정확히 동일).
  3. systemctl --user enable gnome-folding-at-screenlock.service. 잠금 및 잠금 해제는 데스크탑 사용자에게 연결되어 있으므로 루트로 실행하거나 sudo를 사용하지 마십시오.
  4. systemctl --user start gnome-folding-at-screenlock.service. 루트로 실행하거나 sudo를 사용하지 마십시오.
  5. 완벽한! 이제 컴퓨터에서 자리를 비울 때마다 super+를 눌러 화면을 잠그세요. l단백질이 즉시 접히기 시작합니다! 돌아와서 컴퓨터의 잠금을 해제하면 접기가 즉시 일시 중지됩니다!
  6. 보너스 포인트를 얻으려면 GNOME으로 이동하여 Settings > Power자동 일시 중지를 끄십시오. 그렇지 않으면 확장 축소가 작동하지 않습니다. 기본적으로 20분 동안 활동이 없으면 일시 중지되며 FAH도 중지됩니다.

답변2

답변에서 영감을 얻은 빠르고 더러운 솔루션은 다음과 같습니다.https://unix.stackexchange.com/a/259963.

#!/bin/bash

let TIMEOUT_MINUTES=5
let TIMEOUT_MS=TIMEOUT_MINUTES*60000

while [ 0 ]
do
IDLE=$(xprintidle)
    if [ $IDLE -lt $TIMEOUT_MS ]
        then
            FAHClient --send-pause
        else
            FAHClient --send-unpause
    fi
    sleep 15
done

TIMEOUT_MINUTES및 값을 원하는 대로 변경 sleep하고 로그인 시 시작되도록 설정하면 됩니다.

xprintidleFedora 37을 실행할 때처럼 저장소에 없으면 소스에서 빌드할 수 있습니다(다음 위치에서 사용 가능) .https://github.com/g0hl1n/xprintidle).

관련 정보