Creating PyOpenCl context causes later access violation - pyopencl

I just started to experiment with OpenCL using pyopencl. I got it from here
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopencl
I wrote some test programms and excecuting worked as expected. Than when I wanted to start a big batch of simulations I got random crashes with Access Violations (Windows Error Code FFFFFFFFC0000005) . It turns out that any script in which I import pyopencl and create a context crashes after one to two minute. I run 3 tests and got [63sec, 86sec, 81sec].
I have ensured that the context is always on my 'Intel(R) HD Graphics 620' card by setting the environment variable PYOPENCL_CTX = 1:0
import pyopencl as cl
ctx = cl.create_some_context()
import time
i = 0
while True:
print("Im alive since %i seconds" % i, flush = True)
i += 1
time.sleep(1.0)
I have a Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] from python.org
Edit:
After removing the environment variable and just letting the shell sit in the choose platform dialog - wihtout choosing a platform - crashes after about a minute with Access Violation.
Edit:
I updated the Driver Vesion to the latest available 22.20.16.4771 (from 13/08/2017) but the problem persists.

This may be due to outdated driver. In the case that the computer vendor does not provide up-to-date drivers a generic driver from Intel may work, eventhough there is no guarantee of compatibility.
Intel only provides driver as self installing .exe which don't allow driver installation when it notices that a custom version of there drivers is running.
However one can circumvent this check by letting the self uncompressing .exe uncrompess. Copy the data from the temp folder it creates and then manually install these drivers usind the widnows device manager. It goes without saying that this easily may break a setup.

Related

deja vu: Why am I seeing "the application was unable to start correctly (0xc000007b)"

Platform: Windows 10 Pro 64-bit [Version 10.0.15063]; Xeon CPU E3-1220 v3, 3101 Mhz, 4 Core(s), no HT; 32 GB ECC memory; Visual Studio 2017 Community Edition.
I am working on NTPD, the Network Time Protocol Daemon, trying to make it more accurate.
My revised version of NTPD ran from 3/16/17 until yesterday, 8/20/17. I finally got my readTemps.exe C# program working yesterday; all it does is read the CPU and System temperatures every 10 seconds, and waits for NTPD to ask for them via UDP. NTPD starts readTemps.
However, there was a problem in that NTPD could not start readTemps as Administrator, which is needed, I believe, for readTemps to interface with WMI. So I put code in readTemps to detect if it is running as Administrator, and if not restart itself thusly.
In test mode, a driver program can start readTemps, access temperatures for a minute, and stop readTemps, but NTPD can no longer do anything!.
At first it stopped in the very beginning when it was trying to request privileges to set the system time (which is not my code and has worked forever).
Now it cannot even load, failing with the error "(t)he application was unable to start correctly (0xc000007b)."
Using my backup program I replaced the newly compiled versions of ntpd.exe and ntpd.lib with the versions that had run successfully from 3/16--8/20/17, but still I get the (0xc000007b) error.
I downloaded Dependency Walker (DW) and ran it on the ntpd.exe image that worked for 5 months. DW found the following errors:
Error: At least one required implicit or forwarded dependency was not
found.
Error: At least one module has an unresolved import due to a
missing export function in an implicitly dependent module.
Error:Modules with different CPU types were found.
Error: A circular dependency was detected.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a
missing export function in a delay-load dependent module.
In particular, DW finds that dozens of dll's are missing, e..g.,
API-MS-WIN-CORE-REGISTRY-L1-1-1.DLL
API-MS-WIN-CORE-REGISTRY-L2-2-0.DLL
API-MS-WIN-CORE-RTLSUPPORT-L1-2-0.DLL
API-MS-WIN-CORE-SIDEBYSIDE-L1-1-0.DLL
API-MS-WIN-CORE-STRING-L2-1-0.DLL
etc., etc., etc
.
I can't find these dll's either using the dir /S command, not on C:, the system disk, and not on K:, where Visual Studio 2017 Community Edition is installed.
Does anyone have any idea what could possibly be wrong?

Windows 7 Driver - Only Runs Once then Requires a Reboot

Lately, I have been playing with drivers in Windows 7. So far, I have built a driver that can talk with a user mode application.
However, I keep having a problem starting and stopping the driver.
First, I install the driver and start it, and it works just fine. I stop it, and it stops fine as well. However, when I go to start it again, it errors out with an error 2 code "Can't find the file specified".
In order to fix this, I have to uninstall the driver, then reboot. Once I have rebooted, I can install it again, and run it once, and then the process starts all over.
So my question is how do I work around this problem? I really hate having to reboot every time I rebuild and test my driver, so I was wondering if I am doing something wrong in my build and deployment process.
I am using the standard DDK command line build for the build process, and I am using an app called OSR Driver Loader to load the driver. I can, however, use the SC command line to install it as well.
I solved it. I needed to delete the symbolic link that I was creating, and to delete the Device instance.
Here is the code I out into the OnUnload function:
// this deletes the symbolic link for the driver
IoDeleteSymbolicLink(&deviceLinkUnicodeString);
// this deletes the device
IoDeleteDevice(g_RootkitDevice);
So In full, I needed to have this as my OnUnload function:
VOID OnUnload(IN PDRIVER_OBJECT DriverObject)
{
// this deletes the symbolic link for the driver
IoDeleteSymbolicLink(&deviceLinkUnicodeString);
// this deletes the device
IoDeleteDevice(g_RootkitDevice);
}

WDK Driver load issue (The service cannot be started, either because it is disabled)

I have used windows 8.1 to write many drivers with no issues when loading what so ever. There seems to be some sort of issue when I try to load a new basic KMDF driver that I built in visual studio. I am able to edit source and compile new versions of driver projects built while on previous versions of windows and I assume WDK would be the true culprit here. I am able to load drivers that the original project was generated in Windows 8.1 even if I edit the source and recompile, but specifically If I try to create a new driver project through visual studio, namely the example base for Kernel Mode Driver, it fails to load with the error :
"The service cannot be started, either because it is disabled or because it has no enabled devices associated with it"
A couple points :
The driver fails to load with the same error every time, I have my own certified trusted certificate from digicert and I have tried disabling driver signature enforcement, both with the same error. So it is safe to say that certificates is not the issue.
The only main difference I can tell between the old and new WDK sources is the old version specifically has versions of windows to build from, but the new has "universal" although through settings it looks like it will just build for Windows 10.
I am not doing any stupid errors meaning, I am compiling x64, etc...
I'm starting to think that the WDK KMDF basic template may have some sort of issue with it.
I would rather not have to gut an old project (driver) to get a successful "new" driver to load.
Can you please specify is it a legacy driver or a pnp driver.
I faced a similar issue, but the mistake I was doing was compiling a pnp driver and trying to load it as a legacy driver.
To specify the difference for completion sake pnp would be a driver that comes with a AddDevice routine. Such driver are expected to have a start type as 0 and are loaded at boot time. Need to attach the driver to a specific device object in the add device routine.
The legacy drivers are one with no AddDevice routine and we call IoCreateDevice from DriverEntry itself.

Which cab should I deploy to my handheld device to install CF version 2?

Based on what I read here, in order to install CF version 2 on my handheld device, I should copy over one of the cab files here:
...but which one?
The device in question is a Symbol 3090, which currently has only CF version 1.0.3316.00 (1.0 SP2) installed. The OS version of the device is 05.00.1400
The device CPU is presumably 'ARMV4I' as a similar device (Motorola 3190) says that it is equipped with such.
UPDATE
Based on what I see here when I click "this link" here:
-- OR -- If you have Windows Mobile 5 or newer on your device, click this link and save the file to the desktop of your computer.
...it seems "NETCFv2.wm.armv4i.cab" is probably the best choice.
Any refutations?
UPDATE 2
I copied the file I reckoned to be the one, and clicked it on the device, but:
What in Sam L. Clemens' illustrious memory is going on here?!?
UPDATE 3
I then copied over the other file from the link above, which was slightly different (2.12MB as opposed to 2.14MB, for one thing), and tried to run it, and got the same err msg as above.
UPDATE 4
Trying to install from the last link, I see:
UPDATE 5
Actually, it turns out that what I might really need is to install CF version 1 after a cold boot of the device...but I don't know if version 1 of CF is still available. That's the only version the existing .exe will run on, but my PC only has cab files for versions 2 and 3.5...???
UPDATE 6
In the most recent version of the .exe (builds and compiles, but won't run on either device), it has three, count 'em three mscorlibs in its References area; the versions are:
1.0.5000.0
2.0.0.0
3.5.0.0
They all have the same public key token (the same as shown in the screen shot)
The only other multi-reference is System, which has both version 2 and 3.5
AND, below System.Xml, there are three coredll.dlls, albeit spelled differently:
coredll.dll
CoreDll.dll
CoreDll.DLL
(no info for any of them...???)
UPDATE 7
I copied NETCFv2.wce4.ARMV4.cab to the 3090.
I 2-clicked it on the device, but got this:
And so, I retreated (selected "No").
Thus continue unabated the travails of an accidental handheld developer.
UPDATE 8
The project is set to Framework Version == v2.0, Platform == Windows CE, Target Device == Windows Mobile 6 Classic Emulator (one of the few emulator choices I have), and the output shows that it is ARMV4i that is being deployed:
Deploying '%CSIDL_PROGRAM_FILES%\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\ARMV4i
\sqlce.ppc.wce5.armv4i.CAB'
Deploying '%CSIDL_PROGRAM_FILES%\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\ARMV4i
\sqlce.repl.ppc.wce5.armv4i.CAB'
Deploying '%CSIDL_PROGRAM_FILES%\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\ARMV4i
\sqlce.dev.enu.ppc.wce5.armv4i.CAB'
Deploying 'C:\Program Files (x86)\Motorola EMDK for .NET\v2.8\SDK\Smart Devices\wce500\armv4i\symbol.all.arm.cab'
And when I run the .exe in the emulator, it fails with, "Error - An unexpected error has occurred in Platypus.exe
Select Quit and restart this program, or select Details for more information.
This application requires a newer version of the MS .NET Compact Framework than the version installed on this device."
Selecting the "Details" button augments the mental anguish with, "TypeLoadException
This application requires a newer version of the MS .NET Compact Framework than the version installed on this device."
Assuming your are using the WinCE 4.2 version of the 3090 (it comes in 4.2 and 5.0), you should proceed with the install using NETCFv2.wce4.ARMV4.cab. "The program is not compatible..." message is a warning only, and not a very smart one. There is even a way to edit the cab to remove that warning if you wanted to, though my memory fails me on the exact way to do it. I've had to do it to allow a silent install before (otherwise the nag screen gets in your way).
First you need to figure out what version of CE you are running. You can find this by going to System Properties. Also while you are in System Properties note what processor you are running ( arm, mips ...). If you are running windows ce 4.2 or higher you will pick a cab file out of the wce400 folder. If you are running windows CE 5.0 or higher you will pick a cab file out of the wce500 folder. Note you can't install .net 2.0 on windows ce 4.1 or lower, according to Microsoft documentation, however, I have noticed that the minimum version setting on the cab files is 4.0, so you might be able to hack it.
Like I said before on also the System Properties page is the type of processor you are using. From that select the appropriate sub-folder in either wce400 or wce500. In most of the folders for each processor there should be only one cab file. If there is more than one cab file see if the file name contains wm for windows mobile, wce for windows ce, or ppc for pocket PC and pick the one most appropriate for you.
You can also take the guess work out of this whole process by creating an ini file with the fallowing text and using ceappmgn.exe to pick and install the right cab file for you.
[CEAppManager]
Version = 1.0
Component = NETCF
[NETCF]
Description = .NET Compact Framework v2.0
CabFiles=wce400\armv4\NETCFv2.ppc.armv4.cab,wce400\armv4\NETCFv2.wce4.ARMV4.cab,wce400\mipsii\NETCFv2.wce4.MIPSII.cab,wce400\mipsiv\NETCFv2.wce4.MIPSIV.cab,wce400\sh4\NETCFv2.wce4.sh4.cab,wce400\x86\NETCFv2.wce4.x86.cab,wce500\armv4i\NETCFv2.wm.armv4i.cab,wce500\mipsii\NETCFv2.wce5.mipsii.cab,wce500\mipsiv\NETCFv2.wce5.mipsiv.cab,wce500\sh4\NETCFv2.wce5.sh4.cab,wce500\armv4i\NETCFv2.wce5.armv4i.cab

Vtune report Outside any known module

I am using Intel(R) VTune(TM) Amplifier XE 2013 Update 5 (build 274450) for my linux application hotspot collect, but the report says the "[Outside any known module]" consume most of the time, so i want to get more info about the unknow module.
when i read the release notes of the vtune Amplifier, it says "List of hotspots may contain "Outside any known module" on systems with kernel older than 2.6.20 (200233501)", but my linux kernel is "2.6.32", any idea about this?
Check that your program is not generating code on the fly (i.e. is not JIT-ing). You may also want to switch grouping to "Module / Code Location / Call stack" and see which virtual addresses cannot be mapped by VTune to any known module.
I have been suffering from this issue in the past as well and it is very frustrating if you don't know why it is happening.
2 weeks ago I installed Ubuntu 13.04 and vtune update 14 and I was jumping from joy because I could see (again) what happened inside my code.
After doing some updates on my Ubuntu, vtune started to show your problem
I installed the kernel sources.. no help..
I reinstalled the driver, no help.
I reinstalled intel vtune.. no help.
And then I decided to run under root, and what do you know.. It works; no more 'Outside any known module'. I switched back to my regular user, it stopped working. I switched back to my root, and it works. So perhaps some kinds of access issue.
Maybe you could try this.
Probably you have some kernel hidden addresses by kptr_restrict, you ca review the value of "/proc/sys/kernel/kptr_restrict":
kptr_restrict = 0, kernel addresses are provided without limitations (recommended).
kptr_restict = 1, addresses are provided if the current user has a CAP_SYSLOG capability.
kptr_restrict = 2, the kernel addresses are hidden regardless of privileges the current user has.
You can use this option before running the trace:
sysctl -w kernel.kptr_restrict=0
More details here: https://software.intel.com/en-us/vtune-help-enabling-linux-kernel-analysis
Hope this helps!

Resources