|
Packit |
345191 |
CONTRIBUTING
|
|
Packit |
345191 |
============
|
|
Packit |
345191 |
|
|
Packit |
345191 |
This file is intended to help those interested in contributing to the
|
|
Packit |
345191 |
memkind library.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
|
|
Packit |
345191 |
COMMUNICATION
|
|
Packit |
345191 |
=============
|
|
Packit |
345191 |
|
|
Packit |
345191 |
Please participate in the memkind mailing list:
|
|
Packit |
345191 |
|
|
Packit |
345191 |
https://lists.01.org/mailman/listinfo/memkind
|
|
Packit |
345191 |
|
|
Packit |
345191 |
There is also the option of opening an issue through github:
|
|
Packit |
345191 |
|
|
Packit |
345191 |
https://github.com/memkind/memkind/issues
|
|
Packit |
345191 |
|
|
Packit |
345191 |
The mailing list is intended for discussion and the issues are useful
|
|
Packit |
345191 |
for tracking progress on tasks. The TODO file lists out a number of
|
|
Packit |
345191 |
topics, and in order to prioritize one of them please open a github
|
|
Packit |
345191 |
issue with a related subject.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
|
|
Packit |
345191 |
TESTING
|
|
Packit |
345191 |
=======
|
|
Packit |
345191 |
|
|
Packit |
345191 |
The tests require a Linux kernel newer than 3.11 (the details are
|
|
Packit |
345191 |
documented in the memkind README), and the reservation of 3000 huge
|
|
Packit |
345191 |
pages. The huge pages can be reserved with the following command:
|
|
Packit |
345191 |
|
|
Packit |
345191 |
$ sudo echo 3000 > /proc/sys/vm/nr_hugepages
|
|
Packit |
345191 |
|
|
Packit |
345191 |
Only in the case where gigabyte pages have been reserved will the
|
|
Packit |
345191 |
tests associated with gigabyte pages be executed. Reserving gigabyte
|
|
Packit |
345191 |
pages may require a modification to the kernel command line unless the
|
|
Packit |
345191 |
kernel is quite recent.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
To test memkind simply execute the "make check" target after building.
|
|
Packit |
345191 |
This target calls memkind/test/test.sh with parameters
|
|
Packit |
345191 |
depending on the environment.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
Most of the tests are written within the gtest framework, however, as
|
|
Packit |
345191 |
part of testing the example programs are also executed and the return
|
|
Packit |
345191 |
code of the executable determines pass or fail. The autotools test
|
|
Packit |
345191 |
infrastructure is used as a high level executor, but it does not track
|
|
Packit |
345191 |
individual tests. The consequence of this is that the autotools
|
|
Packit |
345191 |
output records only one high level test which passes in the case where
|
|
Packit |
345191 |
every underlying test was successful and fails if any underlying test
|
|
Packit |
345191 |
fails. The individual test results are recorded in the directory
|
|
Packit |
345191 |
called "gtest_output." Here you will find the log of the tests in
|
|
Packit |
345191 |
gtest_output/test.out and a set of junit style xml results: one for
|
|
Packit |
345191 |
each test. Note that a side effect of having only one autotools test
|
|
Packit |
345191 |
is that autotools parallel testing is disabled. We have
|
|
Packit |
345191 |
multi-threaded tests that use the OpenMP run-time which enables more
|
|
Packit |
345191 |
purposeful and deterministic testing of threading issues. Note that
|
|
Packit |
345191 |
the OpenMP run-time is only required for testing, it is not used by
|
|
Packit |
345191 |
the memkind library internally.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
|
|
Packit |
345191 |
CODING STYLE
|
|
Packit |
345191 |
============
|
|
Packit |
345191 |
|
|
Packit |
345191 |
Before submitting a patch for inclusion, please run the modified
|
|
Packit |
345191 |
source code files through astyle with the following options
|
|
Packit |
345191 |
|
|
Packit |
345191 |
$ astyle --style=linux --indent=spaces=4 -S --max-continuation-indent=80 \
|
|
Packit |
345191 |
--max-code-length=80 --break-after-logical --indent-namespaces -z2 \
|
|
Packit |
345191 |
--align-pointer=name
|
|
Packit |
345191 |
|
|
Packit |
345191 |
More information about astyle can be found here:
|
|
Packit |
345191 |
|
|
Packit |
345191 |
http://astyle.sourceforge.net/
|
|
Packit |
345191 |
|
|
Packit |
345191 |
In C, source code constants are in all caps and everything else is in
|
|
Packit |
345191 |
all lower case. Underscores are used to separate words within a
|
|
Packit |
345191 |
symbol name. No camel case shall be used in C code. The test code is
|
|
Packit |
345191 |
largely written in C++. Here camel-case should be used for class
|
|
Packit |
345191 |
names and should always have a capitalized first letter. Other
|
|
Packit |
345191 |
symbols in C++ should generally follow the C style.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
Most symbols with global scope shall be prefixed with "memkind_" or
|
|
Packit |
345191 |
"hbw_" depending on which interface they are a part of.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
Any global variable shall have _g appended to the variable name and in
|
|
Packit |
345191 |
most cases shall be statically scoped within a single compilation
|
|
Packit |
345191 |
unit. The exception to that rule are static memory kinds that are
|
|
Packit |
345191 |
declared as extern within the associated interface header and are
|
|
Packit |
345191 |
constant after initialization. Global variables should be used in a
|
|
Packit |
345191 |
very narrow set of circumstances and in most cases modifications
|
|
Packit |
345191 |
should be guarded with pthread_once(3).
|
|
Packit |
345191 |
|
|
Packit |
345191 |
Functions not used outside of the compilation unit shall be declared
|
|
Packit |
345191 |
as static. All functions which are not declared as static shall be
|
|
Packit |
345191 |
documented in a man page and have an associated interface header file.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
Preprocessor mark-up is discouraged when other options are possible.
|
|
Packit |
345191 |
Please use enum in place of #define when value control at configure or
|
|
Packit |
345191 |
build time is not required.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
|
|
Packit |
345191 |
TESTS
|
|
Packit |
345191 |
=====
|
|
Packit |
345191 |
|
|
Packit |
345191 |
The current state of the tests is not nearly as well organized as it
|
|
Packit |
345191 |
could be. That being said, it is quite simple to add a new test.
|
|
Packit |
345191 |
Most C++ files in the test directory are associated with a single
|
|
Packit |
345191 |
gtest testing::Test class. These classes usually have several
|
|
Packit |
345191 |
associated test fixtures in the same file. If a new test can be added
|
|
Packit |
345191 |
as a fixture to an existing class, simply add the fixture to the file
|
|
Packit |
345191 |
and the test will be incorporated into the test infrastructure.
|
|
Packit |
345191 |
If a new class is required, create a new file and add it to the list
|
|
Packit |
345191 |
of "test_all_tests_SOURCES" in memkind/test/Makfile.mk and it will
|
|
Packit |
345191 |
be incorporated into the test infrastructure.
|
|
Packit |
345191 |
|
|
Packit |
345191 |
There are a few files which define classes which are not google test
|
|
Packit |
345191 |
classes. These are check.cpp, trial_generator.cpp and main.cpp. The
|
|
Packit |
345191 |
check.cpp file defines a class Check that can be used to validate
|
|
Packit |
345191 |
fundamental memkind features like NUMA node location, and page size.
|
|
Packit |
345191 |
The trial_generator.cpp file is used to abstract a sequence of
|
|
Packit |
345191 |
allocation and deallocation calls while performing checks on the
|
|
Packit |
345191 |
results of each call; this can be used to apply similar tests to all
|
|
Packit |
345191 |
of the different allocation APIs. The main.cpp file is a simple
|
|
Packit |
345191 |
wrapper around testing::InitGoogleTest and RUN_ALL_TESTS().
|
|
Packit |
345191 |
|
|
Packit |
345191 |
|
|
Packit |
345191 |
SUBMITTING A PATCH
|
|
Packit |
345191 |
==================
|
|
Packit |
345191 |
|
|
Packit |
345191 |
Please be sure that all tests pass before submission and that the
|
|
Packit |
345191 |
style conforms to the specifications given here. If a new feature is
|
|
Packit |
345191 |
implemented in the patch, please also include unit tests and an
|
|
Packit |
345191 |
example which exercises this feature. Once these requirements have
|
|
Packit |
345191 |
been met, please submit a pull request through github.
|