неделя, 10 декември 2017 г.

How to monitor what's using the GPU

Something very funny since I'm using my GPU for holiday mining. When I run calculation on Maple, my GPU falls dramatically. Which I find very odd. It shouldn't be like this at all - I have enough cores to and RAM to rum CPU calculation together with GPU one.
So anyway, here's how you find what's using your GPU:
$fuser -v /dev/nvidiactl
It shows just the ethminer for me. You can do also:
$fuser -v /dev/nvidia*
if you want to see all the nvidia stuff.

Some other useful commands (source):
lspci -vnnn | perl -lne 'print if /^\d+\:.+(\[\S+\:\S+\])/' | grep VGA
this shows which is your active VGA controller.
Other things:
nvidia-settings
doesn't appear to work on my system. Claims I don't have the nvidia xdriver.
This one:
sudo lshw -C display
shows the two controllers.
A very cool more complicated command:
sudo lspci  -v -s  $(sudo lspci | grep ' VGA ' | cut -d" " -f 1)
will give you a lot  of info on your main VGA.
I think I have mentioned here already the
$nvidia-smi
A cool thing is also to use Chrome and about:gpu where you can find all kinds of info. 

събота, 2 декември 2017 г.

How to reset nvidia card without reboot

That actually worked great and as far as I can see din't affect anything on my working X:
############
$./ethminer --list-devices
 ✘  12:51:37|ethminer  No OpenCL platforms found
 ✘  12:51:37|ethminer  CUDA error: unknown error
$sudo rmmod nvidia-modeset
rmmod: ERROR: Module nvidia_modeset is in use by: nvidia_drm
$sudo rmmod nvidia-uvm
$sudo rmmod nvidia-modeset
rmmod: ERROR: Module nvidia_modeset is in use by: nvidia_drm
$sudo rmmod nvidia_drm
$sudo rmmod nvidia-modeset
$./ethminer --list-devices
Listing OpenCL devices.
FORMAT: [platformID] [deviceID] deviceName
[0] [0] GeForce GT 750M
       CL_DEVICE_TYPE: GPU
       CL_DEVICE_GLOBAL_MEM_SIZE: 4235001856
       CL_DEVICE_MAX_MEM_ALLOC_SIZE: 1058750464
       CL_DEVICE_MAX_WORK_GROUP_SIZE: 1024

Listing CUDA devices.
FORMAT: [deviceID] deviceName
[0] GeForce GT 750M
       Compute version: 3.0
       cudaDeviceProp::totalGlobalMem: 4235001856

############3

понеделник, 27 ноември 2017 г.

How to stop browser notifications

In Firefox do:
about:config
And set to false those two entries:
dom.webnotifications.enabled  
dom.webnotifications.serviceworker.enabled 

In Chrome:
Settings -> Advanced Settings ->  “Do not allow any site to show notifications”.
Opera:
Settings ->  Websites -> Notifications ->
“Do not allow any site to show notifications”.

четвъртък, 23 ноември 2017 г.

My (brief) history of mining

I decided to try to mine coins with my laptop. It's hard to answer why now, when the difficulty is so high, instead of when I bought my laptop, when it would have been much more cost-effective, but I wanted to see what my precious laptop is worth 3 years later.
So first, I'm doing a system-wide backup, just in case, because well, my laptop is not very young anymore. And better safe than (very) sorry.
After some googling, I decided to try MinerGate (it is an affiliate link). Because I thought mining alone, on my old laptop maybe won't be a good idea. Since I'm mining with that pool since today, I don't know about the earnings. But I'd like to share other impressions:

  • There is NO(!!!) client for Gentoo/Sabayon. But, surprise surprise, their Windows client works very nicely trough Wine. You just download and run it. At some point I may try to install their Ubuntu client, but I wanted to first experiment with them for a while. 
  • The client is VEEEERY simple. Seriously, I'm actually shocked how simple and pretty it is. And it works fine. I'm mining some 2.5 cores, because I need to have at least 1.5 core on my disposal for work. Also, I'm mining ETH on my Nvidia GPU. I'm doing this, because apart from occasional Steam game and 1 month CUDA course, this video card hasn't seen ANY action in those 3 years. So I decided it needs to see some heat. 
  • GPU mining is tricky on the client. So for 1 hour, I run GPU mining from the client just fine, no complain whatsoever. Than I decided to see what happens if you turn on 1 thread of CPU. Well, it started creating the DAG file (it took forever) and at 96% or so it gave me an unknown error. But that also screwed my GPU mining and even after restart, it's still not working. Oh well. It could be because the DAG file is 1.5GB and I have only 2GB in my home dir. But still...
  • The client has extended mode. From it you can see info such as SHARES:GOOD/BAD/LAST, Difficulty, unconfirmed balance etc. Stuff you can see on their website dashboard (which is very useful)
  • Now, being the smart I am, I downloaded ethminer (from here) and started konsole GPU mining with:
    #ethminer -G -F http://eth.pool.minergate.com:55751/email
  • And it worked!
  • A great tutorial on mining with ethminer can be found here.  
  • Note: you can mine a pool without minergate. For a list of pools see here. All you need to mine is your wallet adress. But that will work well I guess for more serious machines. Also, here's a tutorial how to mine with GETH.
  • The MinerGate client and the dashboard know that the console miner is online and count the shares. Which is kind of cool. 
  • There is a bat script on their website which has a bit more options to set in you would like. 
  • Note : on my pc, I got the following error: "No work. Pause for 3 s.  m  16:20:53|ethminer  Waiting for work package...", so I'm not using the bat script. 
  • There is calculator on the website. Which enables you to see what are the coins worth bothering to mine. 
  • The dashboard of the website is very cute, has tons of info, shows you realtime what you're running, how much 

Well, that's it. I kind of like the ethminer simplicity. We'll see what will come out of my mining efforts. Obviously, with this computer I cannot mine for profit. But I can do it for fun.
Last - it seems that ETH wallets are a pain. I have an Exodus, but for now it's empty. In this website, you can find an explanation how to create a wallet with geth (geth account new) . In Sabayon it seems that the package to install is go-ethereum. 
P.S. I'm also using hashflare.io (affiliate link) to cloud mine. For experimental purposes. Because I wanted to buy some fraction of BTC but most sites required sending them your ID. This site accepted credit card. For the moment, the site seems ok, I withdrew my first earnings. But only time will show how good it is.

събота, 7 октомври 2017 г.

How to make a transition to https

That turned out to be very very simple.
First you need to have some SSL certificate installed, but luckily my hosting provider had already installed AutoSSL  and it was already active.
If you like me have MyBB forum then you need to go to
Home >> Board Settings>>General Configuration  
And change in the field: Board URL http to https.
Finally, in your htaccess file you need to write:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

And that was all.

неделя, 13 август 2017 г.

Sheltered won't load

After the last update of my system, Sheltered ran from Steam, wouldn't load. Which obviously left me devastated or at least very curious what the hell went wrong.
The error I got from running Steam from console was:
GameAction [AppID 356040, ActionID 2] : LaunchApp changed task to WaitingGameWindow with ""
ERROR: ld.so: object '~/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
GameAction [AppID 356040, ActionID 2] : LaunchApp changed task to Completed with ""

But later, after running the game from its directory with
 ./Sheltered.x86_64
it transformed into:
Set current directory to ~/Steam/steamapps/common/Sheltered
Found path: ~/Steam/steamapps/common/Sheltered/Sheltered.x86_64
Mono path[0] = '~/Steam/steamapps/common/Sheltered/Sheltered_Data/Managed'
Mono path[1] = '~/Steam/steamapps/common/Sheltered/Sheltered_Data/Mono'
Mono config path = '~/Steam/steamapps/common/Sheltered/Sheltered_Data/Mono/etc'
displaymanager : xrandr version warning. 1.5
client has 4 screens
displaymanager screen (0)(eDP1): 1920 x 1080
Using libudev for joystick management


Importing game controller configs

Oddly enough, the game would run in I'm offline. 
 So the solution, turned out to be, starting it with:
 ./Sheltered.x86_64 LIBGL_ALWAYS_SOFTWARE=1

After which, the  game started running also from Steam. Go figure.

In the meanwhile, I found this useful script for redirecting the errordump of Steam:
cd ~/.local/share/Steam/linux32
mv steamerrorreporter steamerrorreporter.bak
echo "#!/bin/bash" >steamerrorreporter
echo "exit 0" >>steamerrorreporter
chmod a+x steamerrorreporter
source 
And also, to speed up the game launch:
echo "" > /proc/sys/kernel/core_pattern
 
And also, note the great Arch Steam/Troubleshooting site.  
 
Also oddly enough, KSP starts ok with:
vblank_mode=0 optirun -b primus %command%
even though the suggested is: 
LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 %command%_64 -force-gfx-direct 

Other suggested options:
 LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 optirun steam
or 
find ~/.steam/root/ \( -name "libgcc_s.so*" -o -name "libstdc++.so*" -o -name "libxcb.so*" \) -print -delete 
or
Remove:

.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6

.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib/i386-linux-gnu/libgcc_s.so.1

.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu/libgcc_s.so.1

.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6

.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libxcb.so.1 
or
 rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6
I did those and also, I did a reset of Steam and that made Steam stop loading for quite a while, so be careful with those.  
Location of the error dump:
/tmp/dumps     
or
LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 optirun steam 

How to switch between PulseAudio outputs with a button

I have horrible problems with my audio, due to a faulted audio jack. Basically what happens is that the PulseAudio keeps on switching between Headphones (which are not plugged in, but it thinks they are) and the Speakers. So what I decided to do is to put a shortcut on my panel to the file:
change_to_speakers.sh with the content:
#!/bin/bash
pactl set-sink-port alsa_output.pci-0000_00_1b.0.analog-stereo analog-output-speaker

then I created a .desktop file with the content:
#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Name=Speakers
Type=Application
Comment=Speakers
Exec="~/scripts/change_to_speaker.sh"
Icon=
GenericName=Speakers

After giving permission to run to the sh file with:
$chmod+x change_to_speaker.sh
I can switch to the speakers with just one click. Of course, that doesn't help with my faulty jack but at least makes the situation one idea more bearable.
They say you can also edit:
/etc/pulse/default.pa to: load-module module-stream-restore restore_device=false
to turn off the automatic switching upon detecting new plugged in device but I'd rather not do it, because I don't want it to affect my usb speakers. Though I might do it one day.
Another way to stop the interference of the faulty jack is trough
$hdajackretask 
which is part of alsa-tools-gui.
I tried this once, the effect was total loss of sound on my laptop. So I decided this might be a bit too brutal for my tast.
Also, note I'm not using pactl set-sink-port as in pactl set-sink-port 1 analog-output-speaker because for some reason I get an error when I do it. Maybe because I have more than one sound cards.
Also useful commands to check what sound cards you have and the names of the sinks (or sources) are:
#pactl list sinks 
#pactl list sources
#pactl list cards