Write your own Einstein@home screensaver

cecht
cecht
Joined: 7 Mar 18
Posts: 1421
Credit: 2445219645
RAC: 1493144

Holmis wrote:Could this also

Holmis wrote:
Could this also be done in Linux?
I'm sure it can but sadly I don't know how.

Sadly, I haven't figured that out yet.  Good thought though.

 

Ideas are not fixed, nor should they be; we live in model-dependent reality.

Mike Hewson
Mike Hewson
Moderator
Joined: 1 Dec 05
Posts: 6534
Credit: 284710168
RAC: 110462

Ah. I feel a shell script

Ah. I feel a shell script coming on. Put the graphics executable in /var/lib/boinc-client/projects/einstein.phys.uwm.edu. I don't think it will be deleted there. Create the wee script as listed below, graphics_app.sh, into the /var/lib/boinc-client/projects/einstein.phys.uwm.edu directory also. Right click on it to get the Properties dialog and then under Permissions on it's property dialog with a tick in the box "Allow executing file as program". Then run that script from that directory eg. sudo ./graphics_app.sh. Voila !

Graphics_app.sh contains simply :

#!/bin/bash

cd ../../slots/0

../../projects/einstein.phys.uwm.edu/graphics_starsphere_TEST012_x86_64-pc-linux

 

.... this makes the current working directory slot 0 but executes the graphics app from further back up the tree.  So you only need to change TEST012 to whatever in future. I chose slot 0 in the script because it's always likely to be there. But this is temporising. I note that in each slot directory are a few interesting files :

- boinc_mmap_file & boinc_lockfile, these are probably the files that do the inter-process communication. And not just for the graphics app.

- boinc_EinsteinHS_x, where x is the slot number. Contains :

<graphics_info>
  <skypos_rac>2.928</skypos_rac>
  <skypos_dec>1.159</skypos_dec>
  <fraction_done>0.850</fraction_done>
  <cpu_time>60682.503</cpu_time>
  <update_time>1589335733.687</update_time>
  <frequency>872.000</frequency>
  <bandwidth>16.000</bandwidth>
  <boinc_status>
    <no_heartbeat>0</no_heartbeat>
    <suspended>0</suspended>
    <quit_request>0</quit_request>
    <reread_init_data_file>0</reread_init_data_file>
    <abort_request>0</abort_request>
    <working_set_size>780931100.000</working_set_size>
    <max_working_set_size>12552310000.000</max_working_set_size>
  </boinc_status>
</graphics_info>

.... clearly meant for the graphics app to get the data from. I could convert the skypos_rac ( right ascension in radians ) & skypos_dec ( declination in radians ) values to put a marker on the celestial sphere for instance. EinsteinHS is the name of the shared memory segment BTW.

- initi_data.xml, which contains a feast of xml goodies.

Cheers, Mike.

I have made this letter longer than usual because I lack the time to make it shorter ...

... and my other CPU is a Ryzen 5950X :-) Blaise Pascal

Gary Roberts
Gary Roberts
Moderator
Joined: 9 Feb 05
Posts: 5842
Credit: 109398606667
RAC: 35706631

cecht wrote:Holmis

cecht wrote:
Holmis wrote:
Could this also be done in Linux?
I'm sure it can but sadly I don't know how.
Sadly, I haven't figured that out yet.  Good thought though

It probably depends on the desktop environment that your distro is using.  In my distro of choice (PCLinuxOS) the DE is KDE Plasma 5.  If I right click the desktop, I get a popup window and I can select "Create New ... -> Link to Application ..." as one of several different types of links that can be created.

Selecting that, opens a new popup with 4 tabs, each containing fields in which relevant information can be added.  Things like short name to use, permissions, working directory, icon to use, full name of application, command line and options, etc., can easily be customised - as much or as little as you want/need.  When finished, you can save it as an icon on the desktop, or as a smaller icon in the panel so that it can easily be launched when other windows might be covering a desktop icon.

Since you may have many slot directories (high thread count CPUs plus multiple GPU tasks) if you wanted to follow different tasks in different slots, I guess you would need multiple launch icons, each tied to a particular slot number.  You could 'rotate' sequentially through all your slots - or perhaps run them all in parallel if you went beserk with that :-).  With any luck you could find a way to get 100% bling and 0% science if you really tried very hard ;-) :-).

Cheers,
Gary.

cecht
cecht
Joined: 7 Mar 18
Posts: 1421
Credit: 2445219645
RAC: 1493144

Okay, yes, got it. Mike's

Okay, yes, got it. Mike's simple shell script works! I modified it, however, to use explicit path names and named it HewsonSphere.sh, then followed up on Gary's suggestion of creating a desktop launcher. To make that app, I wrote to my Desktop (Gnome) a text file named HewsonSphere.desktop with this content :

   [Desktop Entry]
   Version=1.0
   Name=E@Hscreensaver
   Comment=launch screensaver
   Exec=sudo /var/lib/boinc-client/projects/einstein.phys.uwm.edu/HewsonSphere.sh
   Path=/home/craig/Desktop
   Terminal=true
   Type=Application
   Categories=Utility;Application;
   Name[en_US]=HewsonSphere

When clicked on the first time, the system asked if I want to trust it, -yes-, which made it executable and provided a default icon. Subsequent clicking on the icon launches a terminal window that prompts for my password (because, sudo), et voilà! the screen saver comes up with my E@H info.

Oh, and I changed the owner and group of the shell script and the TEST program to 'boinc', though am not sure whether that was necessary.

 

Ideas are not fixed, nor should they be; we live in model-dependent reality.

Mike Hewson
Mike Hewson
Moderator
Joined: 1 Dec 05
Posts: 6534
Credit: 284710168
RAC: 110462

Aha ! So it appears that it

Aha ! So it appears that it is the graphics application's working directory that needs to be one of the slot directories where the science application and memory mapped file(s) are. So, permissions aside, this makes matters simpler for debugging.

Cheers, Mike.

I have made this letter longer than usual because I lack the time to make it shorter ...

... and my other CPU is a Ryzen 5950X :-) Blaise Pascal

Mike Hewson
Mike Hewson
Moderator
Joined: 1 Dec 05
Posts: 6534
Credit: 284710168
RAC: 110462

Now I will be differentiating

Now I will be differentiating cases. There will be an EinsteinGamma variant for gamma ray searches, an EinsteinRadio variant for radio pulsar searches and an EinsteinGravity variant for continuous GW searching.

I'll start with the Gamma variant. Here is the  linux & win32 versions of TEST013. Each has the newly found logo : that of the Fermi space telescope which is nice looking. I've reduced the size of the help HUD and added WU information. That WU detail will update every 1000 frames.

Now one can do the working directory thing within the program and after much fuss & botheration :

#include <unistd.h>

#if defined(_WIN32) || defined(_WIN64)
       // For Windows use the following path.
       chdir("C:\\Program Data\\BOINC\\slots\\0");
#else
       // For linux use the following path.
       chdir("/var/lib/boinc-client/slots/0");
#endif 

..... seems to generally do the trick ie. will expect to have the slot 0 as working directory. Except the win64 builds won't execute for some obtuse reason. Also the user data sometimes is not filled even though the WU data is. This is all terribly non-portable anyway. It depends on the actual boinc client directory which will vary, plus of course nothing may be happening in slot 0 as it did once while I was testing.  Needs more work. If only BOINC set some relevant environment variables then .......

Cheers, Mike.

( edit ) I've got them to start in fullscreen mode but not drop out with mouse move or keypress ( except ESC ). Easier to test. I've discovered on Windows :

- that if you change the file extension from 'exe' to 'scr' and then right click on that it has an install option which, when pressed, puts it in as the system screensaver !

- there is a mildly disturbing interval of lower resolution desktop b/4 it kicks in.

I have made this letter longer than usual because I lack the time to make it shorter ...

... and my other CPU is a Ryzen 5950X :-) Blaise Pascal

Mike Hewson
Mike Hewson
Moderator
Joined: 1 Dec 05
Posts: 6534
Credit: 284710168
RAC: 110462

Got it. Obvious really. I was

Got it. Obvious really. I was looking for something complicated. The screensavers seem to be put in the project directory, which is always a subdirectory of projects, that in turn is always in the boinc install directory. So assume it is in the project directory ie. einstein.phys.uwm.edu. Then use relative paths, viz : 

#if defined(_WIN32) || defined(_WIN64)
    // For Windows use the following path.
    chdir("..\\..\\slots\\0");
#else
    // For linux use the following path.
    chdir("../../slots/0");
#endif

... seems to work quite well. Funny how explaining something helps to solve it. I don't have to solve the problem of how the graphics app gets to the project directory. Not my department. I just have to get it to run properly if it is.

So with that solved here is (  TEST013A ) the linux and win32 Gamma variants with relative paths built in.

Cheers, Mike.

I have made this letter longer than usual because I lack the time to make it shorter ...

... and my other CPU is a Ryzen 5950X :-) Blaise Pascal

Holmis
Joined: 4 Jan 05
Posts: 1118
Credit: 1055935564
RAC: 0

Both 13 & 13A seems to work

Both 13 & 13A seems to work but I get a strange issue of low resolution when the screensaver can access Boinc data. Happens both if I create a shortcut with the working directory specified or if I run it from ..projects/eintein.phys.uwm.edu
If I run the program from another folder so that it doesn't have access to Boinc data then I get higher resolution for both the HUD and the star sphere.

In Windows Boinc stores various information and settings in the Registry, check out:

HKEY_LOCAL_MACHINE\SOFTWARE\Space Sciences Laboratory, U.C. Berkeley
and
HKEY_CURRENT_USER\Software\Space Sciences Laboratory, U.C. Berkeley

Mike Hewson
Mike Hewson
Moderator
Joined: 1 Dec 05
Posts: 6534
Credit: 284710168
RAC: 110462

That's because I'm adhering

That's because I'm adhering to BOINC specified screensaver behaviour, in this instance specifically following BOINC preferred screen width and height. That's 800 by 600. Rather dated I'll admit, but that's what the project preferences say when accessed. If that can't be found then I set it at whatever your desktop is. For that matter I'm supposed to be refreshing at 20 frames per second too ......

Cheers, Mike.

I have made this letter longer than usual because I lack the time to make it shorter ...

... and my other CPU is a Ryzen 5950X :-) Blaise Pascal

Holmis
Joined: 4 Jan 05
Posts: 1118
Credit: 1055935564
RAC: 0

Ah, that explains it. I

Ah, that explains it.
I change my project prefs and set the screen saver resolution to match my normal values and now it looks way better! Thanks!

Keep up the good work!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.