Rework `Macros.hpp` for devices

Open
#303 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

Start with src/Macros.hpp around line 148 and the usage in src/ArraySlice.hpp around lines 56-57. Examine how LVARRAY_ERROR_IF handles MSG on devices and determine how the device output can become useful instead of showing the unevaluated expression; done means the GPU stacktrace reports the relevant message.

Written by the indexing model from the issue text.

Description

The MSG argument fo the LVARRAY_ERROR_IF is useless when used on a GPU (device):

https://github.com/GEOS-DEV/LvArray/blob/86af5bfb5204d94dd7b1f4bcf98a37b8de9a630c/src/Macros.hpp#L148

For example, the expression in https://github.com/GEOS-DEV/LvArray/blob/86af5bfb5204d94dd7b1f4bcf98a37b8de9a630c/src/ArraySlice.hpp#L56-L57

is printed as Array Bounds Check Failed: index= << index << m_dims[0]= << m_dims[0] in the stacktraces (unevaluated, hence not helpful).

One could use printf or snprintf together with MSG and ... variadic macros arguments which can be used as printf(MSG, __VA_ARGS__); maybe in combination with __VA_OPT__.

Dominant language
C++
Stars
49
Forks
9
Avg merge
5d 15h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GEOS-DEV/LvArray

All issues in GEOS-DEV/LvArray

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.