Changeset b8ddf2e in sasmodels


Ignore:
Timestamp:
Feb 7, 2017 2:34:29 PM (4 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
d2b939c
Parents:
96c2b98
Message:

use correct allocation size for the returned result

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernelcl.py

    r96c2b98 rb8ddf2e  
    464464        # architectures tested so far. 
    465465        if self.is_2d: 
    466             # Note: 17 rather than 15 because results is 2 elements 
    467             # longer than input. 
    468             width = ((self.nq+17)//16)*16 
     466            # Note: 16 rather than 15 because result is 1 longer than input. 
     467            width = ((self.nq+16)//16)*16 
    469468            self.q = np.empty((width, 2), dtype=dtype) 
    470469            self.q[:self.nq, 0] = q_vectors[0] 
    471470            self.q[:self.nq, 1] = q_vectors[1] 
    472471        else: 
    473             # Note: 33 rather than 31 because results is 2 elements 
    474             # longer than input. 
    475             width = ((self.nq+33)//32)*32 
     472            # Note: 32 rather than 31 because result is 1 longer than input. 
     473            width = ((self.nq+32)//32)*32 
    476474            self.q = np.empty(width, dtype=dtype) 
    477475            self.q[:self.nq] = q_vectors[0] 
     
    523521        self.dim = '2d' if q_input.is_2d else '1d' 
    524522        # plus three for the normalization values 
    525         self.result = np.empty(q_input.nq+3, dtype) 
     523        self.result = np.empty(q_input.nq+1, dtype) 
    526524 
    527525        # Inputs and outputs for each kernel call 
     
    530528        self.queue = env.get_queue(dtype) 
    531529 
    532         q_size = max(len(self.result), q_input.global_size[0]) 
    533530        self.result_b = cl.Buffer(self.queue.context, mf.READ_WRITE, 
    534                                   q_size * dtype.itemsize) 
     531                                  q_input.global_size[0] * dtype.itemsize) 
    535532        self.q_input = q_input # allocated by GpuInput above 
    536533 
Note: See TracChangeset for help on using the changeset viewer.