Question: I am using ARM Mali T604 GPU. I've created a memory object using ALLOC\_HOST\_PTR. I would like to know if the following procedure is valid? Can I access(reading only) the memory object in GPU and mapped (as read only) same memory object in CPU simultaneously?

Step 1: unmap memory object (previously mapped as CL\_MAP\_READ\_WRITE)

Step 2: map the memory object back using CL\_MAP\_READ (argument to the clEnqueueMapBuffer())

Step 3: read and process the data by CPU and GPU at the same time (but I'll not do any write operations on this memory object)

Step 4: unmap memory object

Step 5: map the memory object using CL\_MAP\_READ\_WRITE to host.

In other words, my objective at the end of the day is to have a memory object which is readable by CPU and GPU at the same time. Is this possible in Mali OpenCL platform?

Answer: 
You could use [`rewrite`](http://nginx.org/r/rewrite):

```
rewrite ^((/...(..)..(..).+)\.gif)$ /$3/$4$2$1 last;

```

or [`alias`](http://nginx.org/r/alias) in location:

```
location ~ ^((/...(..)..(..).+)\.gif)$ {
    alias /path/to/root/$3/$4$2$1;
}

```
If you string length is definite as shown in your example. You could use a regex like:

```
(?<=\w\/)((.{3}(.{2}).{2}(.{2}).+)\..+)$

```

[**Demo**](http://regex101.com/r/uL0zQ0)  

Here groups are:  

1 = `sc5147006x0SvS.gif`  

2 = `sc5147006x0SvS`  

3 = `14`  

4 = `06`  

Now use these groups to form the resulting URL.