分类 Linux 下的文章

[记录]在Linux上移除了坚果云客户端

坚果云客户端今天强制升级了,开机就两个坚果云图标,后来发现是系统中一个,个人用户下一个。而且还强制添加自启动,在KDE下禁用一个,重启之后又变两个了。并且还要重新登录和重新设置同步位置,问题是KDE下仍然无法打开坚果云的设置界面,它的更新的通知点开看也是一片空白,几个月前就报过bug,但现在也还没有见到修正。既然无法使用,也只有移除了,现在将一些必须同步的东西迁移到了私有云,其它像文献之类的今后只在Windows下看吧。感觉现在Linux下很难找到国内比较好用的同步盘了。

[笔记]自己笔记本上最快的python补全方案设置

个人笔记,如有转载,请注明出处。

——by realasking

2020-03-26 增加关于(jedi:setup)的说明

2020-03-21 最初版本

最近一两年,因为使用python比较多,而其它ide总有让人不满意的地方,以及一些其它原因,就将主要使用的编辑器从原先使用的Linux下的vimWindows下的notepad++统一替换为了Emacs。经过较长时间的磨合和多次重构配置文件,Emacs环境已经基本符合自己的习惯。然而,python补全始终是个比较大的问题:在Linux下使用elpycompany虽然有可以感知的延迟,但是还能忍受,在Windows 10下延迟就很大了,特别是补全np.array之类的内容的时候,能等待数秒,甚至十几秒。

这一两年来,翻遍了网页也没有找到解决办法,于是就开始尝试其它方案,最近两天终于折腾出一个反应明显更快的配置。我使用了Emacs-jediauto-completeformat-all,以及Emacs自带的python-mode,在LinuxWindows下虽然仍然有延迟,但比起elpylsp来说,补全还是快了不少,经过简化的配置如下:

(defvar myPackages
  '(format-all
    jedi
   ))
(mapc #'(lambda (package)
      (unless (package-installed-p package)
        (package-install package)))
      myPackages)
(setq python-shell-interpreter "ipython"
      python-shell-interpreter-args "--simple-prompt -i")
(global-set-key [f6] 'run-python)
(defun python-mode-modify()
  (hs-minor-mode t)
  )
(add-hook 'python-mode-hook (lambda ()
                  (jedi:ac-setup)
                  (setq ac-use-quick-help nil)
                  (setq jedi:tooltip-method nil)
                  (setq jedi:complete-on-dot t)
                  (auto-complete-mode 1)))
(add-hook 'python-mode-hook 'python-mode-modify)

补充:有人问我为什么不写(jedi:setup),这个在jedi的官网上是有说明的,如果只需要补全,用(jedi:ac-setup)就够了,如果还需要签名文档提示、函数参数表之类的,就用(jedi:setup)。用(jedi:ac-setup)的时候的确不需要设置(setq jedi:tooltip-method nil)这一句,这一句的意思是在minibuffer中显示签名文档提示,简化配置贴上来的时候我忘了删了。

[笔记]中国移动光宽带用户下载Github项目中releases压缩包的办法

个人笔记,如有转载,请注明出处。

——by realasking

我家用的中国移动送的移动光宽带,以前在家干活儿时间少,没有觉得有啥不便,最近因为疫情问题,没有出家门,终于觉得移动光宽带上某些站点实在难以忍受了。

最近一段时间,用移动光宽带下载Github上的项目的releases包和更新AUR里的很多包,速度都慢到令人发指。上午8点到10点,下午2点到4点稍快,能达到50KiB/s,其它时候都在7~8KiB/s,而且关键是,如果挂在那里不管,下载一段时间后就会中断。Github的东西又不能续传,更新几次VTKLAMMPS等等简直要了老命了。百度网盘的离线下载就是废物,技术水平可能太水了,尽管买了超级会员,离线下载的时候总是资源不存在。

好在经过一番搜索,找到了解决的办法,直接用微软账号登录offcloud.com,然后把链接拷贝到页面上的对话框,什么都不用再改,直接回车,就能开始顺利下载了,下载速度基本上保持在120KiB/s~2MiB/s,也没中断,很好了。只是AUR的更新就得手动完成,不过这也不算麻烦,可以将就用着了。

[原创]无光线传感器笔记本上自动调整亮度的设置

2020-03-03:补充和clight作者交流后得知的扩充功能的方法

2020-02-21:创建文章

本文章中的操作为原创内容,适用于Manjaro Linux和Microsoft Windows 10,其余环境未作尝试,软件从网上获得。本文如有转载,请注明出处。
——by realasking

最近一直写东西,眼睛有些受不了,但是自己的电脑都没有光线传感器,亮度得不断调整,为了解决这个问题,就在网上搜索了一下,在Manjaro和Win10上分别找到了实现办法,记录如下:

使用Manjaro Linux的联想小新潮7000笔记本实现应用摄像头测光的屏幕亮度自动调整

安装clight和clightd

yaourt -S clight-git clightd-git

clight的配置

该软件安装之后,重启计算机服务就会自动打开,但是默认调光是线性的,没有考虑到两个问题:
1.人的视觉感受不是线性的
2.光线强到一定程度发生溢出之后的所有量化值都一样了
所以需要我们重新配置
该软件配置文件位置在:

/etc/default/clight.conf

根据说明,我调整了这几项:

#调光步长
backlight_trans_step = 0.05;
#图片亮度取值为[0,1],然后分成11个刻度,每个刻度对应屏幕约化亮度
ac_backlight_regression_points = [ 0.0, 0.082, 0.133, 0.2046, 0.2758, 0.33, 0.385, 0.408, 0.52, 0.69, 1.0 ];
batt_backlight_regression_points = [ 0.0, 0.08, 0.128, 0.19, 0.25, 0.297, 0.338, 0.35, 0.44, 0.57, 0.80 ];
#用5帧的结果调光
captures = 5;
#北京的经纬度
latitude = 39.9;
longitude = 116.5;

两组对应亮度的参数我均以最近白天靠阳台房间窗口背光处笔记本云很少的时候的笔记本适合我的感观的亮度作为基准,对应于第7,8个数字,其余部分尽量平滑的变化到最大值和最小值,然后再根据自己的感受做了一定调整。高亮度部分不如低亮度部分可靠,对应的点太少。
使用中感觉要好了不少,但是在夜间,有时测光后亮度会非常亮,这种感觉不好,尚不知原因。

创建clight个人模块,增加夜间停用自动调光功能

夜间有时自动调光亮度过亮,不知道原因,但win下没有这问题,经过和作者交流(夜间停用调光),得知可以通过创建个人模块的办法来解决,做法是:

创建一个c语言模块文件

比如叫a.c。
我所用的模块是将作者回复我的内容稍作修改实现的。我加上夜间先调光的内容,将夜间的亮度先设置为0.16,然后再关闭。

编译为模块

gcc -shared -fPIC a.c -o NightOFF -Wno-unused

然后拷贝到:

a="~/.local/share/clight/modules.d"
mkdir "$a" && cp NightOFF "$a"

详情见自定义模块

然后重启就好了。
该软件作者非常热情,回复很积极,很开心。

Windows 10下用摄像头测光并调整亮度的办法

软件的选择

Windows下曾经有多个软件可以实现这样的功能,然而,现在已经不容易找到了,经过反复搜索,找到了BLUntrl和SoftonEyes这两个还能下载使用的软件。然而,这两个软件均不能自己设定调光频率而且摄像头持续开启,其中BLUntrl还需要结合nircmd才能使用,会导致不断弹窗。
不过摄像头的开闭可以通过打开关闭程序来实现,所以最终选择使用SoftonEyes。

软件安装

解压SoftonEyes到D:\Tools\SoftonEyes,用choco安装AutoHotKeys和AutoHotKeys compiler

软件配置

建立AdjustBrightness.ahk,内容如下:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
Loop
{
   Run, D:\Tools\SoftonEyes.exe
     Sleep, 10000
   Run, taskkill /im SoftonEyes* /F,,Hide
     Sleep, 1800000
}
Return

编译该文件,然后把快捷方式加入开机运行即可。

【笔记】在联想小新潮7000-15ARR+Manjaro Linux使用pyopencl和amd开源显卡驱动的安装配置

个人笔记,如有转载,请注明出处。
——by realasking


众所周知,amdgpu开源驱动的opengl硬件加速性能比amdgpu-pro闭源显卡更好,但其通过mesa实现的opencl只能支持到1.1版,而且并不总能正常的工作。如果能在开源显卡驱动的基础上安装闭源驱动中的opencl支持,显然是非常好的事情。好在AUR中就提供有这样的方案。

安装

yaourt -S opencl-amd ocl-icd opencl-headers clinfo pyopencl-headers python-pyopencl

检查


[realasking@zh-pc ~]$ clinfo 
Number of platforms                               2
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (2906.7)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback cl_amd_offline_devices 
  Platform Host timer resolution                  1ns
  Platform Extensions function suffix             AMD

Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (2906.7)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback cl_amd_offline_devices 
  Platform Host timer resolution                  1ns
  Platform Extensions function suffix             AMD

Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     gfx804
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 1.2 AMD-APP (2906.7)
  Driver Version                                  2906.7
  Device OpenCL C Version                         OpenCL C 1.2 
  Device Type                                     GPU
  Device Board Name (AMD)                         Radeon 500 Series
  Device Topology (AMD)                           PCI-E, 01:00.0
  Device Profile                                  FULL_PROFILE
  Device Available                                Yes
  Compiler Available                              Yes
  Linker Available                                Yes
  Max compute units                               8
  SIMD per compute unit (AMD)                     4
  SIMD width (AMD)                                16
  SIMD instruction width (AMD)                    1
  Max clock frequency                             1124MHz
  Graphics IP (AMD)                               8.0
  Device Partition                                (core)
    Max number of sub-devices                     8
    Supported partition types                     None
    Supported affinity domains                    (n/a)
  Max work item dimensions                        3
  Max work item sizes                             1024x1024x1024
  Max work group size                             256
  Preferred work group size (AMD)                 256
  Max work group size (AMD)                       1024
  Preferred work group size multiple              64
  Wavefront width (AMD)                           64
  Preferred / native vector sizes
char 4 / 4
short 2 / 2
int 1 / 1
long 1 / 1
half 1 / 1 (cl_khr_fp16) float 1 / 1
double 1 / 1 (cl_khr_fp64) Half-precision Floating-point support (cl_khr_fp16) Denormals No Infinity and NANs No Round to nearest No Round to zero No Round to infinity No IEEE754-2008 fused multiply-add No Support is emulated in software No Single-precision Floating-point support (core) Denormals No Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Correctly-rounded divide and sqrt operations Yes Double-precision Floating-point support (cl_khr_fp64) Denormals Yes Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Address bits 64, Little-Endian Global memory size 2141634560 (1.995GiB) Global free memory (AMD) 2071608 (1.976GiB) Global memory channels (AMD) 2 Global memory banks per channel (AMD) 16 Global memory bank width (AMD) 256 bytes Error Correction support No Max memory allocation 1596849766 (1.487GiB) Unified memory for Host and Device No Minimum alignment for any data type 128 bytes Alignment of base address 2048 bits (256 bytes) Global Memory cache type Read/Write Global Memory cache size 16384 (16KiB) Global Memory cache line size 64 bytes Image support Yes Max number of samplers per kernel 16 Max size for 1D images from buffer 134217728 pixels Max 1D or 2D image array size 2048 images Base address alignment for 2D image buffers 256 bytes Pitch alignment for 2D image buffers 256 pixels Max 2D image size 16384x16384 pixels Max 3D image size 2048x2048x2048 pixels Max number of read image args 128 Max number of write image args 8 Local memory type Local Local memory size 32768 (32KiB) Local memory syze per CU (AMD) 65536 (64KiB) Local memory banks (AMD) 32 Max number of constant args 8 Max constant buffer size 1596849766 (1.487GiB) Preferred constant buffer size (AMD) 16384 (16KiB) Max size of kernel argument 1024 Queue properties
Out-of-order execution No Profiling Yes Prefer user sync for interop Yes Profiling timer resolution 1ns Profiling timer offset since Epoch (AMD) 1580776646713521172ns (Tue Feb 4 08:37:26 2020) Execution capabilities
Run OpenCL kernels Yes Run native kernels No Thread trace supported (AMD) Yes Number of async queues (AMD) 2 Max real-time compute queues (AMD) 0 Max real-time compute units (AMD) 0 SPIR versions 1.2 printf() buffer size 4194304 (4MiB) Built-in kernels (n/a) Device Extensions cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_amd_bus_addressable_memory cl_khr_spir cl_khr_gl_event Platform Name AMD Accelerated Parallel Processing Number of devices 1 Device Name gfx902 Device Vendor Advanced Micro Devices, Inc. Device Vendor ID 0x1002 Device Version OpenCL 2.0 AMD-APP (2906.7) Driver Version 2906.7 (PAL,HSAIL) Device OpenCL C Version OpenCL C 2.0 Device Type GPU Device Board Name (AMD) Unknown AMD GPU Device Topology (AMD) PCI-E, 05:00.0 Device Profile FULL_PROFILE Device Available Yes Compiler Available Yes Linker Available Yes Max compute units 8 SIMD per compute unit (AMD) 4 SIMD width (AMD) 16 SIMD instruction width (AMD) 1 Max clock frequency 1100MHz Graphics IP (AMD) 9.2 Device Partition (core) Max number of sub-devices 8 Supported partition types None Supported affinity domains (n/a) Max work item dimensions 3 Max work item sizes 1024x1024x1024 Max work group size 256 Preferred work group size (AMD) 256 Max work group size (AMD) 1024 Preferred work group size multiple 64 Wavefront width (AMD) 64 Preferred / native vector sizes
char 4 / 4
short 2 / 2
int 1 / 1
long 1 / 1
half 1 / 1 (cl_khr_fp16) float 1 / 1
double 1 / 1 (cl_khr_fp64) Half-precision Floating-point support (cl_khr_fp16) Denormals No Infinity and NANs No Round to nearest No Round to zero No Round to infinity No IEEE754-2008 fused multiply-add No Support is emulated in software No Single-precision Floating-point support (core) Denormals No Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Correctly-rounded divide and sqrt operations Yes Double-precision Floating-point support (cl_khr_fp64) Denormals Yes Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Address bits 64, Little-Endian Global memory size 2684354560 (2.5GiB) Global free memory (AMD) 2553760 (2.435GiB) Global memory channels (AMD) 4 Global memory banks per channel (AMD) 4 Global memory bank width (AMD) 256 bytes Error Correction support No Max memory allocation 912680550 (870.4MiB) Unified memory for Host and Device Yes Shared Virtual Memory (SVM) capabilities (core) Coarse-grained buffer sharing Yes Fine-grained buffer sharing Yes Fine-grained system sharing No Atomics No Minimum alignment for any data type 128 bytes Alignment of base address 2048 bits (256 bytes) Preferred alignment for atomics
SVM 0 bytes Global 0 bytes Local 0 bytes Max size for global variable 821412352 (783.4MiB) Preferred total size of global vars 2684354560 (2.5GiB) Global Memory cache type Read/Write Global Memory cache size 16384 (16KiB) Global Memory cache line size 64 bytes Image support Yes Max number of samplers per kernel 16 Max size for 1D images from buffer 134217728 pixels Max 1D or 2D image array size 2048 images Base address alignment for 2D image buffers 256 bytes Pitch alignment for 2D image buffers 256 pixels Max 2D image size 16384x16384 pixels Max 3D image size 2048x2048x2048 pixels Max number of read image args 128 Max number of write image args 64 Max number of read/write image args 64 Max number of pipe args 16 Max active pipe reservations 16 Max pipe packet size 912680550 (870.4MiB) Local memory type Local Local memory size 65536 (64KiB) Local memory syze per CU (AMD) 65536 (64KiB) Local memory banks (AMD) 32 Max number of constant args 8 Max constant buffer size 912680550 (870.4MiB) Preferred constant buffer size (AMD) 16384 (16KiB) Max size of kernel argument 1024 Queue properties (on host)
Out-of-order execution No Profiling Yes Queue properties (on device)
Out-of-order execution Yes Profiling Yes Preferred size 262144 (256KiB) Max size 8388608 (8MiB) Max queues on device 1 Max events on device 1024 Prefer user sync for interop Yes Number of P2P devices (AMD) 0 P2P devices (AMD) (n/a) Profiling timer resolution 1ns Profiling timer offset since Epoch (AMD) 1580776646713519545ns (Tue Feb 4 08:37:26 2020) Execution capabilities
Run OpenCL kernels Yes Run native kernels No Thread trace supported (AMD) Yes Number of async queues (AMD) 4 Max real-time compute queues (AMD) 0 Max real-time compute units (AMD) 0 SPIR versions 1.2 printf() buffer size 4194304 (4MiB) Built-in kernels (n/a) Device Extensions cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_khr_gl_depth_images cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_khr_spir cl_khr_subgroups cl_khr_gl_event cl_khr_depth_images cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_amd_copy_buffer_p2p NULL platform behavior clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) AMD Accelerated Parallel Processing clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) Success [AMD] clCreateContext(NULL, ...) [default] Success [AMD] clCreateContext(NULL, ...) [other] Success [AMD] clCreateContextFromType(NULL, CL_DEVICE_TYPE_DEFAULT) Success (1) Platform Name AMD Accelerated Parallel Processing Device Name gfx804 clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) Success (1) Platform Name AMD Accelerated Parallel Processing Device Name gfx804 clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No devices found in platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) Success (1) Platform Name AMD Accelerated Parallel Processing Device Name gfx804 ICD loader properties ICD loader Name OpenCL ICD Loader ICD loader Vendor OCL Icd free software ICD loader Version 2.2.12 ICD loader Profile OpenCL 2.2

切换显卡

使用环境变量PYOPENCL_CTX='0''1'

最新文章

最近回复

  • realasking: 哪里的话,还要非常感...
  • cnfczn: 发送留言报错:in_...
  • cnfczn: 大狮兄666,以前经...
  • realasking: 最近还行啊,就是上网...
  • cnfczn: 大狮兄,好久不见啊....
  • realasking: 您好。有什么问题就在...
  • Eric Chen: 作者你好!最近折腾中...

分类

归档

其它