Skip to content

Commit 44cce4e

Browse files
Merge branch 'release/0.25.6'
2 parents b02664d + fadfb43 commit 44cce4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+771
-865
lines changed

examples/004_fadeeva/000_check_fadeeva.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
import xobjects as xo
2-
from xfields import _pkg_root
3-
41
import time
5-
import numpy as np
2+
63
import matplotlib.pyplot as plt
4+
import numpy as np
75
from scipy.special import wofz
86

7+
import xobjects as xo
8+
99
mode = 'special_y_0'
1010
mode = 'standard'
1111

1212
ctx = xo.ContextCpu(omp_num_threads=0)
1313

1414
src_code = """
15-
/*gpukern*/ void eval_faddeeva_w_q1(
15+
#include "xobjects/headers/common.h"
16+
#include "xfields/fieldmaps/bigaussian_src/faddeeva.h"
17+
18+
GPUKERN void eval_faddeeva_w_q1(
1619
const int n,
17-
/*gpuglmem*/ double const* /*restrict*/ re,
18-
/*gpuglmem*/ double const* /*restrict*/ im,
19-
/*gpuglmem*/ double* /*restrict*/ wz_re,
20-
/*gpuglmem*/ double* /*restrict*/ wz_im )
20+
GPUGLMEM double const* RESTRICT re,
21+
GPUGLMEM double const* RESTRICT im,
22+
GPUGLMEM double* RESTRICT wz_re,
23+
GPUGLMEM double* RESTRICT wz_im )
2124
{
22-
int tid = 0;
23-
for( ; tid < n ; ++tid ) { //autovectorized
24-
25+
VECTORIZE_OVER(tid, n);
2526
if( tid < n )
2627
{
2728
double const x = re[ tid ];
@@ -33,7 +34,7 @@
3334
wz_re[ tid ] = wz_x;
3435
wz_im[ tid ] = wz_y;
3536
}
36-
}
37+
END_VECTORIZE;
3738
}
3839
"""
3940

@@ -50,16 +51,11 @@
5051
),
5152
}
5253

53-
headers = [
54-
_pkg_root.joinpath("headers/constants.h"),
55-
_pkg_root.joinpath("headers/sincos.h"),
56-
_pkg_root.joinpath("headers/power_n.h"),
57-
_pkg_root.joinpath("fieldmaps/bigaussian_src/faddeeva.h"),
58-
]
54+
headers = []
5955

6056
assert mode in ['special_y_0', 'standard']
6157
if mode == "special_y_0":
62-
headers = ["#define FADDEEVA_SPECIAL_Y_0"] + headers
58+
headers = ["#define FADDEEVA_SPECIAL_Y_0"]
6359

6460
ctx.add_kernels(
6561
sources=headers + [src_code], kernels=kernel_descriptions)

pyproject.toml

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,54 @@
11
[build-system]
22
build-backend = 'setuptools.build_meta'
33
requires = [
4-
'setuptools >= 43.0.0',
5-
'numpy',
6-
]
4+
'setuptools>=77.0.0',
5+
]
6+
7+
[project]
8+
name = "xfields"
9+
dynamic = ["version"]
10+
description = "Field Maps and Particle In Cell"
11+
readme = "README.md"
12+
license = "Apache-2.0"
13+
authors = [
14+
{name = "G. Iadarola et al."}
15+
]
16+
dependencies = [
17+
"numpy>=1.0",
18+
"scipy",
19+
"pandas",
20+
"xobjects>=0.0.4",
21+
"xtrack>=0.0.1",
22+
]
23+
requires-python = ">=3.10"
24+
25+
[project.urls]
26+
Homepage = "https://xsuite.readthedocs.io/"
27+
Documentation = "https://xsuite.readthedocs.io/"
28+
Source = "https://github.com/xsuite/xfields"
29+
"Bug Tracker" = "https://github.com/xsuite/xsuite/issues"
30+
Download = "https://pypi.python.org/pypi/xfields"
31+
32+
[project.optional-dependencies]
33+
tests = [
34+
"pytest",
35+
"h5py"
36+
]
37+
38+
[tool.setuptools.packages.find]
39+
where = ["."]
40+
include = ["xfields"]
41+
42+
[tool.setuptools.dynamic]
43+
version = { attr = "xfields._version.__version__" }
44+
45+
[tool.setuptools]
46+
include-package-data = true
47+
48+
[project.entry-points.xobjects]
49+
include = "xfields"
50+
51+
[pytest]
52+
markers = [
53+
"context_dependent: marks test as one that depends on the execution context",
54+
]

setup.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

tests/test_cerrf.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@
88
import pytest
99
import xobjects as xo
1010
from xobjects.context import available
11-
from xfields.general import _pkg_root
1211
from xobjects.test_helpers import for_all_test_contexts
1312

1413

1514
@pytest.fixture
1615
def faddeeva_calculator():
17-
source = '''
18-
/*gpukern*/ void FaddeevaCalculator_compute(FaddeevaCalculatorData data) {
16+
source = """
17+
#include "xobjects/headers/common.h"
18+
#include "xfields/fieldmaps/bigaussian_src/faddeeva.h"
19+
20+
GPUKERN void FaddeevaCalculator_compute(FaddeevaCalculatorData data) {
1921
int64_t len = FaddeevaCalculatorData_len_z_re(data);
2022
21-
for (int64_t ii = 0; ii < len; ii++) { //vectorize_over ii len
23+
VECTORIZE_OVER(ii, len);
2224
double z_re = FaddeevaCalculatorData_get_z_re(data, ii);
2325
double z_im = FaddeevaCalculatorData_get_z_im(data, ii);
2426
double w_re, w_im;
@@ -27,9 +29,9 @@ def faddeeva_calculator():
2729
2830
FaddeevaCalculatorData_set_w_re(data, ii, w_re);
2931
FaddeevaCalculatorData_set_w_im(data, ii, w_im);
30-
} //end_vectorize
32+
END_VECTORIZE;
3133
}
32-
'''
34+
"""
3335

3436
class FaddeevaCalculator(xo.HybridClass):
3537
_xofields = {
@@ -39,13 +41,7 @@ class FaddeevaCalculator(xo.HybridClass):
3941
'w_im': xo.Float64[:],
4042
}
4143

42-
_extra_c_sources = [
43-
_pkg_root.joinpath("headers/constants.h"),
44-
_pkg_root.joinpath("headers/sincos.h"),
45-
_pkg_root.joinpath("headers/power_n.h"),
46-
_pkg_root.joinpath("fieldmaps/bigaussian_src/faddeeva.h"),
47-
source,
48-
]
44+
_extra_c_sources = [source]
4945

5046
_kernels = {
5147
'FaddeevaCalculator_compute': xo.Kernel(

tests/test_temp_slicer.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ def test_digitize(test_context):
3535

3636
@for_all_test_contexts(excluding="ContextPyopencl")
3737
def test_compute_moments_1(test_context):
38-
39-
print(repr(test_context))
40-
4138
###########
4239
# ttbar 2 #
4340
###########

xfields/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
from .beam_elements.electroncloud import ElectronCloud
2727
from .beam_elements.electronlens_interpolated import ElectronLensInterpolated
2828

29-
from .general import _pkg_root
3029
from .config_tools import replace_spacecharge_with_quasi_frozen
3130
from .config_tools import replace_spacecharge_with_PIC
3231
from .config_tools import configure_orbit_dependent_parameters_for_bb

xfields/beam_elements/beambeam2d.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import xobjects as xo
99
import xtrack as xt
1010

11-
from ..general import _pkg_root
1211

1312
class BeamBeamBiGaussian2D(xt.BeamElement):
1413

@@ -40,13 +39,7 @@ class BeamBeamBiGaussian2D(xt.BeamElement):
4039
}
4140

4241
_extra_c_sources= [
43-
_pkg_root.joinpath('headers/constants.h'),
44-
_pkg_root.joinpath('headers/sincos.h'),
45-
_pkg_root.joinpath('headers/power_n.h'),
46-
_pkg_root.joinpath('headers','particle_states.h'),
47-
_pkg_root.joinpath('fieldmaps/bigaussian_src/faddeeva.h'),
48-
_pkg_root.joinpath('fieldmaps/bigaussian_src/bigaussian.h'),
49-
_pkg_root.joinpath('beam_elements/beambeam_src/beambeam2d.h'),
42+
'#include "xfields/beam_elements/beambeam_src/beambeam2d.h"',
5043
]
5144

5245
def __init__(self,

0 commit comments

Comments
 (0)