Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 7483
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Seth Chandler <sethbc@wpi.edu>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: delta407 <delta407@lerfjhax.com>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 7483 depends on: Show dependency tree
Bug 7483 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2002-09-04 16:57 0000
I have modified the setiathome init script to launch multiple processes on
machines with more than one CPU. It deduces CPU count at runtime from
/proc/cpuinfo and shouldn't act differently than the current one when only one
CPU is present. I've not tested it on a single-CPU machine (as I don't have one
readily available) but I am confident it will function properly.

The contents of my /etc/init.d/setiathome follows.
---
#!/sbin/runscript

cpus=`grep -c processor /proc/cpuinfo`

checkconfig() {
        if [ ! -e ${SETIATHOME_DIR} ]
        then
                einfo "Creating ${SETIATHOME_DIR}"
                mkdir ${SETIATHOME_DIR}
        fi

        if [ ! -e ${SETIATHOME_DIR}/user_info.sah ]
        then
                einfo "Setting up SETI@home for the first time"
                cd ${SETIATHOME_DIR}
                ./setiathome -login
        fi

        if [ $cpus != '1' ]; then
                cd ${SETIATHOME_DIR}
                for cpu in `seq 2 $cpus`; do
                        if [ ! -e ${SETIATHOME_DIR}/cpu${cpu} ]; then
                                mkdir ${SETIATHOME_DIR}/cpu${cpu}
                                cp ${SETIATHOME_DIR}/*
${SETIATHOME_DIR}/cpu${cpu} > /dev/null
                                rm ${SETIATHOME_DIR}/cpu${cpu}/*.sah > /dev/null
                                cp ${SETIATHOME_DIR}/user_info.sah
${SETIATHOME_DIR}/cpu${cpu}
                        fi
                done
        fi
}

start() {
        checkconfig


        if [ $cpus = '1' ]; then
                ebegin "Starting SETI@home"
        else
                ebegin "Starting SETI@home ($cpus processors)"
        fi

        for cpu in `seq 1 $cpus`; do
                cd ${SETIATHOME_DIR}
                if [ $cpu != '1' ]; then
                        cd cpu${cpu}
                fi

                ./setiathome ${SETIATHOME_OPTIONS} >&/dev/null&
        done

        eend $?
}

stop() {
        ebegin "Stopping SETI@home"
        killall setiathome
        eend $?
}

------- Comment #1 From Daniel Ahlberg (RETIRED) 2002-11-04 06:53:06 0000 -------
Commited, thanks for the contribution!

------- Comment #2 From delta407 2002-11-04 12:25:03 0000 -------
Dang. I could have sworn I added a comment with changes to fix a couple
potential upgrade issues 
(with new executables not being propagated, etc.) Here's a handmade
pseudo-diff:

  if [ $cpus 
!= '1' ]; then
    cd ${SETIATHOME_DIR}
    for cpu in `seq 2 $cpus`; do
      if [ ! -e 
${SETIATHOME_DIR}/cpu${cpu} ]; then
        mkdir ${SETIATHOME_DIR}/cpu${cpu}
-       cp 
${SETIATHOME_DIR}/* ${SETIATHOME_DIR}/cpu${cpu} > /dev/null
-       rm 
${SETIATHOME_DIR}/cpu${cpu}/*.sah > /dev/null
        cp 
${SETIATHOME_DIR}/user_info.sah${SETIATHOME_DIR}/cpu${cpu}
      fi
    done

fi

...

  for cpu in `seq 1 $cpus`; do
    cd ${SETIATHOME_DIR}
    if [ $cpu != '1' ]; then
      cd 
cpu${cpu}
    fi

    ${SETIATHOME_DIR}/setiathome ${SETIATHOME_OPTIONS} >&/dev/null&

done

------- Comment #3 From SpanKY 2002-11-04 12:34:27 0000 -------
aliz: i'm gonna go ahead and steal this cause i got 2 other seti@home bugs that 
involve rewriting the current setup ... 

------- Comment #4 From Gustavo Felisberto 2003-01-02 07:07:10 0000 -------
grep -c processor /proc/cpuinfo
0

This setup is borked in PPC
I have no ideas on how to fix this. In PPC you get
cat /proc/cpuinfo
cpu             : 740/750
temperature     : 20-24 C (uncalibrated)
clock           : 400MHz
revision        : 130.1 (pvr 0008 8201)
bogomips        : 796.26
machine         : PowerMac1,1
motherboard     : PowerMac1,1 MacRISC Power Macintosh
detected as     : 66 (Blue&White G3)
pmac flags      : 00000000
L2 cache        : 1024K unified
memory          : 512MB
pmac-generation : NewWorld

------- Comment #5 From delta407 2003-01-02 12:17:03 0000 -------
Change 
   cpus=`grep -c processor /proc/cpuinfo` 
to 
   cpus=`grep -c bogomips /proc/cpuinfo` 
 
This should work on both platforms. 

------- Comment #6 From Seth Chandler 2003-04-17 18:39:59 0000 -------
took some stuff from here =)

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug