Open sinayoko opened 9 years ago
Hi,
Were you trying this on the master branch?
Hi Dorthy,
Many thanks for getting back to me. I believe I raised this issue after following the instructions in the README file (install with pip install --pre), so I wasn't using the master branch.
In the email I sent Leonard I mentioned something else I tried today. I forked the ucb/stencil_code repo and connected it to Travis then modified the .travis.yml file slightly to remove the deployment part at the end. The Travis build report is available at https://travis-ci.org/ucb-sejits/ctree/jobs/51127888 and it shows 9 failed tests and 7 errors out of 45 tests.
It was the first time I used Travis though so I may have done something wrong.
Sam
I've managed to run the code using the ordered_halo_enumeration branch and by following the build commands in https://travis-ci.org/ucb-sejits/stencil_code/jobs/64479703. Most of the tests pass (after using gcc-4.8 and adding -framework OpenCL to ~/.ctree.cfg). Note that I'm using OS X 10.9.
I'm including some of the output of nosetests --verbose
for reference:
zero boundary handling should just leave zero's in grid halo ... ok
test_copied_for_c (test.test_boundary_handling.TestBoundaryHandling) ... ok
test_copied_for_ocl (test.test_boundary_handling.TestBoundaryHandling) ... ld: library not found for -lOpenCL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR
test_copied_for_ocl_1d (test.test_boundary_handling.TestBoundaryHandling) ... ld: library not found for -lOpenCL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR
test_copied_for_ocl_3d (test.test_boundary_handling.TestBoundaryHandling) ... ld: library not found for -lOpenCL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR
test_copied_for_python (test.test_boundary_handling.TestBoundaryHandling) ... ok
test_python_clamping (test.test_boundary_handling.TestBoundaryHandling) ... ok
test_compute_local_group_size (test.test_boundary_kernel.TestBoundaryKernel) ... ok
test_exception_for_bad_halo_grid_values (test.test_boundary_kernel.TestBoundaryKernel) ... ok
test_gen_index_in_bounds_conditional (test.test_boundary_kernel.TestBoundaryKernel) ... ok
test_virtual_global_size (test.test_boundary_kernel.TestBoundaryKernel) ... ok
test_2d_heat (test.test_c_end_to_end.TestCEndToEnd) ... ok
test_better_bilateral_filter (test.test_c_end_to_end.TestCEndToEnd) ... ok
test_bilateral_filter (test.test_c_end_to_end.TestCEndToEnd) ... SKIP: not working right now, and is corrupting logs
test_convolution (test.test_c_end_to_end.TestCEndToEnd) ... ok
test_diagnostic_kernel (test.test_c_end_to_end.TestCEndToEnd) ... ok
test_jacobi (test.test_c_end_to_end.TestCEndToEnd) ... ok
test_laplacian (test.test_c_end_to_end.TestCEndToEnd) ... ok
test_laplacian27 (test.test_c_end_to_end.TestCEndToEnd) ... ok
test_1_d (test.test_halo_enumerator.TestHaloEnumerator) ... ok
test_constructor (test.test_halo_enumerator.TestHaloEnumerator) ... ok
test_n_d (test.test_halo_enumerator.TestHaloEnumerator) ... ok
test_with_kernel (test.test_halo_enumerator.TestHaloEnumerator) ... ok
test_compute_local_group_size_1d (test.test_local_size_computer.TestLocalSizeComputer) ... ok
test_compute_local_group_size_2d (test.test_local_size_computer.TestLocalSizeComputer) ... ok
test_compute_local_group_size_3d (test.test_local_size_computer.TestLocalSizeComputer) ... ok
test_local_size_computer_bulky (test.test_local_size_computer.TestLocalSizeComputer) ... ok
test_prod (test.test_local_size_computer.TestLocalSizeComputer) ... ok
test_compute_from_indices (test.test_neighborhood.TestNeighborhood) ... ok
test_moore_neighborhood (test.test_neighborhood.TestNeighborhood) ... ok
test_origin (test.test_neighborhood.TestNeighborhood) ... ok
test_von_neuman_neighborhood (test.test_neighborhood.TestNeighborhood) ... ok
test_2d_heat (test.test_ocl_end_to_end.TestOclEndToEnd) ... ld: library not found for -lOpenCL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR
test_bilateral_filter (test.test_ocl_end_to_end.TestOclEndToEnd) ... ld: library not found for -lOpenCL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR
test_laplacian (test.test_ocl_end_to_end.TestOclEndToEnd) ... ld: library not found for -lOpenCL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR
test_laplacian27 (test.test_ocl_end_to_end.TestOclEndToEnd) ... ld: library not found for -lOpenCL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR
test_1_d (test.test_ordered_halo_enumerator.TestOrderedOrderedHaloEnumerator) ... ok
test_constructor (test.test_ordered_halo_enumerator.TestOrderedOrderedHaloEnumerator) ... ok
test_n_d (test.test_ordered_halo_enumerator.TestOrderedOrderedHaloEnumerator) ... ok
test_neighbor_direction (test.test_ordered_halo_enumerator.TestOrderedOrderedHaloEnumerator) ... ok
test_no_redundancy (test.test_ordered_halo_enumerator.TestOrderedOrderedHaloEnumerator) ... ok
test_point_to_surface_key (test.test_ordered_halo_enumerator.TestOrderedOrderedHaloEnumerator) ... ok
test_with_kernel (test.test_ordered_halo_enumerator.TestOrderedOrderedHaloEnumerator) ... ok
The function_decl helper ... ok
test_interior_points_loop (test.test_stencil_backend.TestStencilBackend) ... ok
test_attribute (test.test_stencil_frontend.TestStencilFrontend) ... ok
project currently supports two special calls ... ok
if for iterates over interior_points or neighbors a semantic node is returned ... ok
function def renames arguments to generated name ... ok
test_python_to_stencil_model (test.test_stencil_frontend.TestStencilFrontend) ... ok
subscripted variables that are parameters to the kernel function ... ok
test_bad_boundary_handling (test.test_stencil_kernel.TestStencilKernel) ... ok
test_bad_neighborhood_id (test.test_stencil_kernel.TestStencilKernel) ... ok
test_default_distance (test.test_stencil_kernel.TestStencilKernel) ... ok
test_no_kernel_exception (test.test_stencil_kernel.TestStencilKernel) ... ok
test_no_neighborhood (test.test_stencil_kernel.TestStencilKernel) ... ok
test_simple_transform (test.test_stencil_omp_transformer.TestUnroll) ... SKIP: not finished
test_leftover_unroll (test.test_stencil_optimizer.TestUnroll) ... SKIP: Optimizer broken by newcl branch
test_simple_unroll (test.test_stencil_optimizer.TestUnroll) ... SKIP: Optimizer broken by newcl branch
Hi Sam,
I managed to reproduce the error that you got in your original post when using the development branch, but not the master branch. The problem seems to stem from a mistake on our part in the sample code:
The neighborhood in simple.py is defined in terms of a two-dimensional space, but the actual data (in_grid) is a one-dimensional array. If you swap the following lines:
kernel = SimpleKernel()
width = 1024
in_grid = numpy.rand(width).astype(numpy.float32) * 1000
to:
kernel = SimpleKernel()
width = 1024
height = 1024
in_grid = numpy.random.rand(height, width).astype(numpy.float32) * 1000
the example should work as expected. Please let us know if this fixes the problem
Hi Dorthy,
I'm afraid it's still not working. I tried this in a new conda environment:
$ conda create -n stencil-issue numpy
$ pip install --pre stencil_code
$ conda install llvmpy
$ cat simple2.py
import numpy
from stencil_code.stencil_kernel import Stencil
class SimpleKernel(Stencil):
neighborhoods = [[
(-1, 1), (0, 1), (1, 1),
(-1, 0), (0, 0), (1, 0),
(-1, -1), (-1, 0), (-1, 1)
]]
def kernel(self, in_grid, out_grid):
for x in self.interior_points(out_grid):
for y in self.neighbors(x, 0):
out_grid[x] += in_grid[y]
kernel = SimpleKernel()
width = 1024
in_grid = numpy.random.rand(width, width).astype(numpy.float32) * 1000
out_grid = kernel(in_grid)
When running the code I get the following error
$ python simple2.py
No handlers could be found for logger "ctree.omp"
Traceback (most recent call last):
File "simple2.py", line 21, in <module>
out_grid = kernel(in_grid)
File "/Users/sinayoks/anaconda/envs/sejits-issue/lib/python2.7/site-packages/stencil_code/stencil_kernel.py", line 394, in __call__
return self.specializer(*args, **kwargs)
File "/Users/sinayoks/anaconda/envs/sejits-issue/lib/python2.7/site-packages/ctree/jit.py", line 154, in __call__
csf = self.finalize(*transform_result)
File "/Users/sinayoks/anaconda/envs/sejits-issue/lib/python2.7/site-packages/stencil_code/stencil_kernel.py", line 361, in finalize
self.output
File "/Users/sinayoks/anaconda/envs/sejits-issue/lib/python2.7/site-packages/stencil_code/stencil_kernel.py", line 139, in finalize
self._c_function = self._compile(entry_name, tree, entry_type)
File "/Users/sinayoks/anaconda/envs/sejits-issue/lib/python2.7/site-packages/ctree/jit.py", line 86, in _compile
self._module = project_node.codegen(**kwargs)
File "/Users/sinayoks/anaconda/envs/sejits-issue/lib/python2.7/site-packages/ctree/nodes.py", line 148, in codegen
submodule = f._compile(f.codegen(), module.compilation_dir)
File "/Users/sinayoks/anaconda/envs/sejits-issue/lib/python2.7/site-packages/ctree/c/nodes.py", line 75, in _compile
ll_module = llvm.core.Module.from_bitcode(bc)
File "/Users/sinayoks/anaconda/envs/sejits-issue/lib/python2.7/site-packages/llvm/core.py", line 419, in from_bitcode
raise Exception(errbuf.getvalue())
Exception: Invalid bitcode signature
But it works for me when using the development branch so I'm not too concerned.
Hi, I've installed stencil_code with pip and tried to run the simple Stencil example from the README file by running:
I get the following error:
Am I doing this wrong?