question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run tests with CPU mode when on CPU+GPU version

See original GitHub issue

I have built the package with

python build/build.py --enable_march_native --enable_mkl_dnn --enable_cuda
pip install -e build
pip install -e .

I think this should build a CPU + GPU version.

When I tried to run pytest -n 2 tests examples -W ignore, some of the tests failed. It appeared to me that some of the functions are only support in CPU mode.

I also tried JAX_ENABLE_X64=1 JAX_NUM_GENERATED_CASES=100 pytest -n auto tests and JAX_ENABLE_X64=0 JAX_NUM_GENERATED_CASES=100 pytest -n auto tests, but neither of them worked.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
skyecommented, Jun 11, 2020

Setting JAX_PLATFORM_NAME is the best way to do this. You can also manually device_put values and/or use the backend argument to various functions like pmap to run things on CPU, but the env var is the best way to set the platform globally (e.g. for performance comparisons).

0reactions
matthewfeickertcommented, Jun 11, 2020

When both CPU and GPU are available and no jax_platform_name flag is set, we preferentially select the GPU backend. After we merge #690, you’ll be able to write this to set the backend from the shell (if you have a posix shell):

JAX_PLATFORM_NAME=cpu pytest -n auto tests -W ignore

@mattjj So does this mean that if you want to be able to toggle using the GPU and the CPU (use case: do a performance comparison of the speedup you get with code using JAX on the GPU (without having to switch between virtual environments with two versions installed)) the preferred way of doing this is by setting the environment value? So either setting it through the Shell like you show above, or by doing

import os
os.environ["JAX_PLATFORM_NAME"] = "cpu"

? Or is there recommended API?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Stress-Test your PC the 'Creator' Way FREE! [CPU ...
How to test if your PC is working properly after you've built it? This is HOW! ... Your browser can't play this video....
Read more >
How to stress test a PC to find errors and crashes - YouTube
Tutorial: Learn how to stress test a new PC build and the software involved! Start configuring your next custom gaming PC with NZXT...
Read more >
Detecting Divergence Using PCAST to Compare GPU to CPU ...
PCAST helps to quickly isolate divergence between CPU and GPU results so you can isolate bugs. Parallel Compiler Assisted Software Testing ( ...
Read more >
The 11 Best Tools to Stress Test Your PC (CPU, RAM, & GPU)
Hardware Monitoring Tools to Use While Running Stress Tests · 1. Core Temp · 2. GPU-Z · 3. MSI Afterburner · 4. HWiNFO64....
Read more >
TensorFlow performance test: CPU VS GPU - Medium
will install tensorflow in CPU mode not optimally, ... How will mobile version of pre-Pascal GPU architecture and only 2Gb of video memory ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found